Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Aug 2010 14:57:34 -0500 (CDT)
From:      Robert Bonomi <bonomi@mail.r-bonomi.com>
To:        freebsd-questions@freebsd.org, jacks@sage-american.com
Subject:   Re: Grepping a list of words
Message-ID:  <201008141957.o7EJvYAa017901@mail.r-bonomi.com>

next in thread | raw e-mail | index | archive | help
> From owner-freebsd-questions@freebsd.org  Thu Aug 12 05:36:27 2010
> Date: Wed, 11 Aug 2010 18:00:22 -0500
> To: freebsd-questions@freebsd.org
> From: "Jack L. Stone" <jacks@sage-american.com>
> Subject: Grepping a list of words
>
> 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.
>
> Thanks for any suggestions...
>

1)  egrep "(word1|word2|word3|word4|....|wordN)" file


2)  grep -F -f wordlist_file  sourcefile



The proverbial advice about "the fine manpage" is relevant. :)

`




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