[ILUG] grep ??
Pádraig Brady
P at draigBrady.com
Mon Nov 5 10:40:21 GMT 2007
Vincent Cunniffe wrote:
> O'Leary Patrick wrote:
>> Hi folks,
>> I have been given a very large logfile & a list of about
>> 40 names. my job is to find every entry in the log which matches each
>> name in the list of names. i was thinking of simply doing something
>> like "cat xyz.log | grep each name > output.txt" but the lazy bugger
>> in me does not feel like doing that 40 times. i've trawled the web but
>> can't come up with a way of giving grep the list of names as a single
>> file. Any suggestions or help would be gratefully appreciated
>
> grep -f names.txt xyz.log > output.txt
And for efficiency...
LANG=C grep -F -f names.txt xyz.log > output.txt
More information about the ILUG
mailing list