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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sed help

Status
Not open for further replies.

chomps303

MIS
Sep 30, 2003
83
US
How can I get sed to tell me what the line number is for a specific line?

ie:

file abc =
aaaaaaaaaa
bbbbbbbbbb
cccccccccc

search for bbbbb and return line 2

Thanks

Brandt
 
Try something like this:
Code:
awk '/bbbbb/{printf "%d\n",NR}' abc

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top