Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Aug 2010 17:14:03 +0530
From:      ashish@FreeBSD.org (Ashish SHUKLA)
To:        "Jack L. Stone" <jacks@sage-american.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Grepping a list of words
Message-ID:  <86bp98dpj0.fsf@chateau.d.if>
In-Reply-To: <3.0.1.32.20100811180022.00ee4250@sage-american.com> (Jack L. Stone's message of "Wed, 11 Aug 2010 18:00:22 -0500")
References:  <3.0.1.32.20100811180022.00ee4250@sage-american.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

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
=2D-=20
Ashish SHUKLA      | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0
freebsd.org!ashish | http://people.freebsd.org/~ashish/

=E2=80=9CThere is nothing new to be discovered in physics now; All that
remains is more and more precise measurement.=E2=80=9D (Lord Kelvin, 1900)

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)

iQIcBAEBCgAGBQJMY96HAAoJEMdGz6nnT6SwVQUP/2f1RC/bYVMUfAiamBc/3pYJ
BJwkRzEIsdpL41mGcrCuR1GXPfKqnK7DbpC7VdC4kZVuRZfAJ34CiH/7+B4j/Qv5
h4oAtvHcUebXy+nqBZ6re3aI1WjfCUGYl+Fk6dC/r/0pcAwo7KRcAz9nyye4a3Nd
HOGC6+5cyHSxCPK+1Qo794rFg81h9jSjxLVsbgY2MrpOn2gAmBHxwd7G1I/taYs0
n8fnnfML2P3PAMwHEp6BXEwTT+vpn8g1M8skWMTqj9/D9yxOXw3bT9Gjs2EyRqrm
Mb0EMMa3tUajR8IXxzw6yuSZ3VxesFFZgIVq+GwTtBBgshUk2chnUX+UVZH0Fzuc
KYbIbZNyd9BMAkxeDXFib/orfEu0iVOfCe0HSSvDM3LQIKIKqriXHQGK9AEjZ1zl
wgyRHwa23M2wiMqofe00gYtZjIRifmNViz/XpXkvcu23y2NB7xlIYZbGDF4q3ZtY
y0FNheriVEUeP58bpPYKyC+FaY41TlgquFsNJIZK2vNKYXuPR9gA6llZYo3ONOvM
HJeXWCJHDlh6gtPp0cca/VKUpBehNxK3O+SMLj9XTSS69dT+6L62cqYcdLxB4Lt0
6smtjbP3L8/lXpTIDbhfqfINpoy6PeLL0DgZnluGDmP2IFqOobToUQnRrrAbG0Ey
7/vhs/E5QZ366sReKA9g
=pxPq
-----END PGP SIGNATURE-----
--=-=-=--



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