[lug] finding text lines in a single file
Carl.Wagner at Level3.com
Tue Apr 27 13:04:18 MDT 2004
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.
I want to grep for each entry in a single log file
grep 123 LogFile
grep 124 LogFile
grep 125 LogFile
grep 126 LogFile
grep `xargs -n 1 -t < EntryFile` LogFile
But that is looking for a file named 123
xargs -n 1 -t < EntryFile egrep LogFile
but that is not what I wanted either.
Basically what I want is
while not EndOfFile(EntryFile)
EntryLine = read EntryFile
grep EntryLine LogFile
I could do this easily in c, but I need to be able to do it in a script.
More information about the LUG