Append file with grep output but add timestamp?
I've setup a cron job that greps a file every five minutes and then writes (appends) the grep output/result to another file:
grep "monkey" zoo.log | tail -1 >> cron-zoo-log
Is there any way I can add the date and time (timestamp) to the cron-zoo-log file for each time a new line was added?
At the moment the cron-zoo-log just looks like this:
monkey house
monkey car
Could I get it to be:
monkey house 2009-01-01:16:54:00
monkey car 2009-01-01:17:01:00
Thank you.
|