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 -->
  #3 (permalink)  
Old 04-29-2009
shivarajM shivarajM is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 12
Arrow I need only first appearance of the pattern ?

Quote:
Originally Posted by Franklin52 View Post
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
I need only first appearance of the matched pattern ?

help me......