The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-28-2006
WillImm123 WillImm123 is offline
Registered User
 

Join Date: Feb 2006
Posts: 5
Grep for Multiple patterns

Hi All,

I have a file. I need to find multiple patterns in a row and need those rows to divert to new file.

I tried using grep -e / -E / -F options as given in man.
But its not working.

==> cat testgrep.txt
william,fernandes,xxxxx
mark,morsov,yyyy
yy=,xx=
yyyy=,xxxx==

==> /usr/xpg4/bin/grep -E 'yy xx' testgrep.txt

It gives not output.
==> /usr/xpg4/bin/grep -F 'yy xx' testgrep.txt


I used pattern file as well
==> cat patterngrep.txt
yy\n
xx\n

/usr/xpg4/bin/grep -e patterngrep.txt testgrep.txt


It is not working.

Please let me if we have anyother method of doing it.

Thanks,
Reply With Quote
Remove advertisements
!!
Forum Sponsor