Script question

jd1008 jd1008 at gmail.com
Mon Jun 15 00:39:27 UTC 2015



On 06/14/2015 06:27 PM, Patrick Hess wrote:
> Polytropon wrote:
>> Or if you want to omit the grep call:
>>
>> awk '/spam=YES/ {print $11}' /var/log/maillog | sort | uniq | sed -e 's/^.*=//' > /tmp/spam-ip.txt
>>
>> And then continue:
>>
>> cat /tmp/spam-ip.txt >> /usr/samba/mail/envelope
>> cat /tmp/spam-ip.txt | mail -s "SPAM IPs...." us.navy at outlook.com
>>
>> Finally, you can easily remove /tmp/spam-ip.txt.
> You could even take this one step further and eliminate the need for
> a temporary file altogether by making use of tee(1):
>
>      awk '/spam=YES/ {print $11}' /var/log/maillog |
>      sort |
>      uniq |
>      sed -e 's/^.*=//' |
>      tee -a /usr/samba/mail/envelope |
>      mail -s "SPAM IPs...." us.navy at outlook.com
>
> Patrick
> _
Patrik, you forgot to add the continuation  \
at end of you lines. The Commander will not be able
to use this as it stands.



More information about the freebsd-questions mailing list