Grepping a list of words

Ashish SHUKLA ashish at
Thu Aug 12 11:44:16 UTC 2010

Jack L Stone writes:
> Kindly appreciate help with how to grep (or similar) a list of words to
> determine if any of them are in a file rather than grepping one word at a
> time.

% egrep 'word1|word2|word3|...|wordn' filename.txt

'word1|word2|word3|...|wordn' is the regular expression, so if you can
minimize it better for you :).

Ashish SHUKLA      | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0!ashish |

“There is nothing new to be discovered in physics now; All that
remains is more and more precise measurement.” (Lord Kelvin, 1900)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list