Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grep

Status
Not open for further replies.

scriptfinder

Technical User
Apr 17, 2006
18
US
Hi!

May be a dumb question but I could not find a right option.

I have a file with the following 2 lines.

abc|123|456
abcdef|235|567|

If I do a "grep" on the file for "abc", I am getting both "abc" and "abcdef", so is there a way I can get the line that contains "abc" only?

Please someone help me.

As usual, you guys rock!


 
perhaps this ?
grep '^abc\|'

some flavors of grep admit the -w option.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top