Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Aug 2010 07:38:55 -0500
From:      "Jack L. Stone" <jacks@sage-american.com>
To:        ashish@FreeBSD.org (Ashish SHUKLA)
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: Grepping a list of words
Message-ID:  <3.0.1.32.20100812073855.00ec5e98@sage-american.com>
In-Reply-To: <86bp98dpj0.fsf@chateau.d.if>
References:  <3.0.1.32.20100811180022.00ee4250@sage-american.com> <3.0.1.32.20100811180022.00ee4250@sage-american.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At 05:14 PM 8.12.2010 +0530, Ashish SHUKLA wrote:
>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

Thanks for the replies. This suggestion won't do the job as the list of
words is very long, maybe 50-60. This is why I asked how to place them all
in a file. One reply dealt with using a file with egrep. I'll try that.

Appreciate the help and any others in case the one doesn't work.

All the best,
Jack

(^_^)
Happy trails,
Jack L. Stone

System Admin
Sage-american



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.1.32.20100812073855.00ec5e98>