Grep OR Operator

by damonp on November 9, 2006

I always forget this…

php -i | grep "Zend\|Cube"

Popularity: 99% [?]

{ 7 comments… read them below or add one }

leorick December 12, 2007 at 8:22 pm

Thanks a lot, save my day! Me too, always forget the backslash…

Reply

Patrick April 18, 2008 at 4:27 pm

Haha, I’ve searched for this one to make my final command (don’t output empty lines and lines starting with comments):

grep -v “^#\|^$” my.cnf

Reply

Steve May 17, 2009 at 4:09 pm

Ha! I’ve just spent ages searching for this.
Great!
My own use:
# iwlist ath0 scan | grep ‘Cell\|ESS\|Freq’

Far more useful output. Quick site survey.
Cheers!

Reply

Chris August 20, 2009 at 11:46 pm

Thanks, very useful. Good catch on the backslash.

Reply

Neo September 11, 2009 at 4:14 pm

egrep And Operator= use egrep twice!
first to filter out locations, second filter out titles
$ egrep -i ‘city1|city2′ joblist | egrep -i ‘director|manager’ > joblist2

Reply

Anthony September 20, 2009 at 1:09 am

Thanks! I always forget the backslash!

Reply

Michael March 20, 2010 at 9:19 am

Why not supporting standard regex in perl and js etc…that is dumb I spent ages until I got here…thanks!

Reply

Leave a Comment

Previous post:

Next post: