Damon Parker is a freelance sysadmin and web developer in Texas. He specializes
in server setup, server security and high performance server configurations.
Need help setting up a web server or getting a server back online after a crash or
hack? Email Damon
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
{ 9 comments… read them below or add one }
Thanks a lot, save my day! Me too, always forget the backslash…
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
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!
Thanks, very useful. Good catch on the backslash.
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
Thanks! I always forget the backslash!
Why not supporting standard regex in perl and js etc…that is dumb I spent ages until I got here…thanks!
yeah that’s why there is sth called egrep!
you could use: egrep “a|b” txt
or: grep -E “a|b” a.txt
cheers!
Thanks.