| Date: Mon, 5 Nov 2007 10:33:30 -0000
| From: "O'Leary Patrick" <Pat.OLeary at rte.ie>
| 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 FILE ...’ (see the GNU grep(1) man page),
where the FILE contains your patterns (REs), one
per line. you may or may not also want the ‘-F’
option (to search for strings rather than REs),
and/or the ‘-i’ option (case insensitive searching).
and you don't need to use cat(1), unless you want
to win the Useless Use of cat Award.
▶ ▶ I AM CURRENTLY LOOKING FOR A JOB! ◀ ◀ | Brian Foster
Experienced (>25 yrs) software engineer: | Montpellier, FRANCE
• Unix, Linux, embedded, design-for-test; | Stop E$$o (ExxonMobile)!
• Software/hardware co-design, debugging; | http:/www.stopesso.com
• Kernels, drivers, filesystems, &tc; Résumé (CV) & contact details:
• IDL, automated testing, process, &tc. http://www.blf.utvinternet.ie
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!