Mar
14
2014

“OR” Operation in “grep”

Since I do not need this frequently, I keep forgetting about this.

To get any lines that matches “durdane” OR “uzeyir” in a text stream you should use “\|” operator (“|” escaped with a backslash) with whole expression in quotes. See below:

 $ grep "durdane\|uzeyir" <text file>

or

 $ <some text stream> | grep "durdane\|uzeyir"
Share
Written by in: desktop,linux,sysadm | Tweet This

No Comments »

RSS feed for comments on this post. TrackBack URL


Leave a Reply

Powered by WordPress | Theme: Aeros 2.0 by TheBuckmaker.com