jeesshnasree
Flight Engineer
Flight Engineer
  • 196 Views

one time only need to print particular matching strings by egrep output occurrence at first line

Hello All,

 

i have one query is  simple but matching strings output by egrep is important .

 

explaining above query in below  detail :

 

i have 3 or multiple strings in a file or log :

 

my requirement is while "egrep"  every matching string should be get first time fetch the word from file and no need get  multiple times for every matching string  for output  .

 

one example :

 

egrep "abc|xyz|qwerty|asdf|mnop" file-name.

....................................................

.............................................

...............................................

...............................................

...................................................

..........................................

.

.

.

 

every sring contain at any row and that sring will be repeat multiple times in the file .

but doing by egrep that matching strings should appear one time all matching  strings in file .

i hope i clearly explained the issue .

 

i am waiting for your valuable reply .

 

Regards ,

Jeesshnasree

 

0 Kudos
Join the discussion
You must log in to join this conversation.