awk question (actively tail a file & notify when expression is found)

Polytropon freebsd at edvax.de
Thu Apr 23 06:27:56 UTC 2009


On Wed, 22 Apr 2009 12:38:47 -0700, Evuraan::ഏവൂരാന്‍  <evuraan at gmail.com> wrote:
> 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 would suggest to keep the system() approach:

	tail -f /var/log/apache2/access.log | awk '/192.168.1.100/ { system(sprintf("echo %s | mail me at email.address", $0)); }'



> Any pointers would be much appreciated.

It should work, but I'm sure someonle else will soon show you
some more elegant way. :-)



-- 
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list