awk : actively tail a file & email when criteria is met
Evuraan::ഏവൂരാന്
evuraan at gmail.com
Wed Apr 22 20:24:47 UTC 2009
thanks for the reply, but thats does not quite help though.
nothing happens until i send a ctrl-c, and then it says,
sh: 0: not found
the emails I recieved does not have txt that shud be the $0 of awk.
2009/4/22 Loïc Grenié <loic.grenie at gmail.com>:
> 2009/4/22 Evuraan::ഏവൂരാന് <evuraan at gmail.com>:
>> 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.
>
> The line above is missing a "system()" :
>
> tail -f /var/log/apache2/access.log | \
> awk ' /192.168.1.100/ { print $0 | system("mail me at email.address "); }'
>
> Does it solve your problem ? Otherwise, could you specify exactly
> what is your problem ? (Command does not start, e-mail received
> is incorrect, etc...)
>
> Hope this helps,
>
> Loïc
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
More information about the ubuntu-users
mailing list