The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 01-05-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,302
Have you tried grep? This gives the number of the line and the line delimited by a colon:

Code:
grep -n <pattern> <file>
To get the number you can do something like:

Code:
grep -n <pattern> <file>| cut -d: -f1
Check the man page of grep and cut for the used options.

Regards