Bash Script (Cygwin) to grep a logfile for multiple phrases and output a new file for each phrase.

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-04-22T05:21:37Z Indexed on 2010/04/22 5:23 UTC
Read the original article Hit count: 204

Filed under:
|

Each logfile is titled based on the date it was created in the format YYYY-MM-DD.txt. I need to search each file for five different keywords and output five files prepended with the specific keyword and then the original logfile name. Example: Test-YYYY-MM-DD.txt

grep -i -w 'keyword1' YYYY-MM-DD.txt > Keyword1-YYYY-MM-DD.txt

If it's also possible to email each new file to a different person, that would be helpful as well.

© Stack Overflow or respective owner

Related posts about grep

Related posts about cygwin