[lug] finding text lines in a single file

Zan Lynx zlynx at acm.org
Tue Apr 27 15:47:52 MDT 2004

On Tue, 2004-04-27 at 13:04, Wagner, Carl wrote:
> Hi,
> I know someone can answer this in about 10 seconds, but I am having a brain lock.
> I have a text file with 1 entry per line.  I want to grep a file for each successive entry, using
> a bash/ksh script.
> Example:
> EntryFile
>    123
>    124
>    125
>    126
> I want to grep for each entry in a single log file
>    grep 123 LogFile
>    grep 124 LogFile
>    grep 125 LogFile
>    grep 126 LogFile

I don't know if it will do what you want, but check out the "join"
program.  From 'man join': "For  each pair of input lines with identical
join fields, write a line to standard output."

It matches on fields, it doesn't search the entire line.  But, if the
data you are searching for in your log files can be described as a
'field', it might work.
Zan Lynx <zlynx at acm.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20040427/f801b1bb/attachment.pgp>

More information about the LUG mailing list