[prog] Grep

Dianne diannes at dbfields.com
Mon May 19 17:02:06 UTC 2008


On Mon, 19 May 2008, Dana Jansens wrote:
>
> Only the first argument is treated as a search term.  You can pipe one
> grep through another though to perform an AND operation, like "grep
> <word1> <filename> | grep <word2>".

And if you want OR logic, use egrep, which supports regular expressions:

egrep 'word1|word2' filename

(The vertical line there is not a pipe; it's there as the OR operator in
the regular expression.)

HTH,

Dianne


More information about the Programming mailing list