awk : actively tail a file & email when criteria is met

Evuraan::ഏവൂരാന്‍ evuraan at gmail.com
Wed Apr 22 19:52:41 UTC 2009


Greetings..!

this below works:

tail -f /var/log/apache2/access.log | \
nawk '/192.168.1.100/{ print $0 }'

and this too:

 tail -f /var/log/apache2/access.log | \
awk ' /192.168.1.100/ { system ("mail -s \"This works\" me at email.address")}'

but this below, does not work:

 tail -f /var/log/apache2/access.log | \
awk ' /192.168.1.100/ {  print $0 | "mail me at email.address  "}'

I tried nawk,gawk etc. still no go.

Any pointers would be much appreciated.

Thx.




More information about the ubuntu-users mailing list