Grepping a list of words
Ashish SHUKLA
ashish at FreeBSD.org
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.
#v+
% egrep 'word1|word2|word3|...|wordn' filename.txt
#v-
'word1|word2|word3|...|wordn' is the regular expression, so if you can
minimize it better for you :).
HTH
--
Ashish SHUKLA | GPG: F682 CDCC 39DC 0FEA E116 20B6 C746 CFA9 E74F A4B0
freebsd.org!ashish | http://people.freebsd.org/~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 : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20100812/1e750f57/attachment.pgp
More information about the freebsd-questions
mailing list