Feb 18, 2004 #1 clegg Programmer Jan 25, 2001 98 GB I want to search for a string plus either of 2 more strings but I don't know how to form the syntax EG cat afile | grep 'text1' AND (text2 OR text3) > results Any help would be appreciated Clegg
I want to search for a string plus either of 2 more strings but I don't know how to form the syntax EG cat afile | grep 'text1' AND (text2 OR text3) > results Any help would be appreciated Clegg
Feb 18, 2004 #2 KenCunningham Technical User Mar 20, 2001 8,475 GB Hi. Try: egrep -e <Value1> -e <Value2) ...etc HTH. Upvote 0 Downvote
Feb 18, 2004 1 #3 PHV MIS Nov 8, 2002 53,708 FR Try something like this: grep 'text1' afile | grep -E 'text2|text3' > results If your grep version don't like the -E option, try this: grep 'text1' afile | egrep 'text2|text3' > results Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 Upvote 0 Downvote
Try something like this: grep 'text1' afile | grep -E 'text2|text3' > results If your grep version don't like the -E option, try this: grep 'text1' afile | egrep 'text2|text3' > results Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
Feb 18, 2004 Thread starter #4 clegg Programmer Jan 25, 2001 98 GB Cheers PHV - that worked!! Upvote 0 Downvote