Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

help with egrep syntax

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 07-28-2005   -   Original Discussion by Gerry405
Gerry405's Unix or Linux Image
Gerry405 Gerry405 is offline
Registered User
 
Join Date: Jun 2005
Last Activity: 22 May 2006, 2:32 AM EDT
Location: Alexandria, Scotland
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
help with egrep syntax

This may seem like a stupid question to anyone but a novice , but I need help with the following ....
can anyone tell me how to change the following command to an "&" rather then an "or"

egrep "GMED|S26" fileForfiltering > newfilteredFile

i need it to contain both strings (on the same line )not one or the other ...the man pages don't help
sample :
RUSSELL,WILLIAMINA S26 PARRI GMED
DOCHERTY,WILLIAM SSITU DONJO GMEDU
READINGS,EDWARD S55 YOUJC GER.AS
MCDONALD,NEIL S11 MORLI UROL
KENNY,JAMES S26 PARRI GMED
HEPBURN,ANNE S54 MITLA GER.AS

Last edited by Gerry405; 07-28-2005 at 02:10 PM..
Sponsored Links
    #2  
Old Unix and Linux 07-28-2005   -   Original Discussion by Gerry405
vgersh99's Unix or Linux Image
vgersh99 vgersh99 is online now Forum Advisor  
Forum Advisor
 
Join Date: Feb 2005
Last Activity: 13 December 2017, 1:28 PM EST
Location: Foxborough, MA
Posts: 8,203
Thanks: 231
Thanked 785 Times in 732 Posts
egrep '(.*GMED.*S26.*|.*S26.*GMED.*)' fileForfiltering > newfilteredFile
Sponsored Links
    #3  
Old Unix and Linux 07-28-2005   -   Original Discussion by Gerry405
Gerry405's Unix or Linux Image
Gerry405 Gerry405 is offline
Registered User
 
Join Date: Jun 2005
Last Activity: 22 May 2006, 2:32 AM EDT
Location: Alexandria, Scotland
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Great !!!

thanks for that, I was nearly pulling my hair out ......It work a treat
    #4  
Old Unix and Linux 08-06-2005   -   Original Discussion by Gerry405
98_1LE's Unix or Linux Image
98_1LE 98_1LE is offline Forum Advisor  
Registered User
 
Join Date: Dec 2000
Last Activity: 21 May 2012, 6:37 PM EDT
Location: Greater Dallas area
Posts: 405
Thanks: 0
Thanked 3 Times in 3 Posts
Yes thank you, I have also been trying to figure this out this morning.
Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
egrep syntax error bjdamon Shell Programming and Scripting 4 09-29-2011 04:30 PM
search ")" with egrep - egrep: syntax error sagarjani UNIX for Dummies Questions & Answers 7 10-14-2008 08:30 AM
Egrep cheat sheet anywhere? Looking for meaning of egrep -c leelm UNIX for Dummies Questions & Answers 2 01-11-2008 03:37 PM
egrep -f tine UNIX for Dummies Questions & Answers 2 06-25-2003 11:28 AM



All times are GMT -4. The time now is 02:46 PM.