[ILUG] grep ??

Vincent Cunniffe vincent at cunniffe.net
Mon Nov 5 10:37:15 GMT 2007


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

Vin



More information about the ILUG mailing list