Script question
Lt. Commander
listmgr at antennex.com
Mon Jun 22 00:56:28 UTC 2015
To: freebsd-questions at freebsd.org
Subject: Re: Script question
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
_______________________________________________
Hi list!
The script guys were very helpful in smoothing out my sh shell script and it
with other script calls are doing the job I needed.
BUT! I took the snippet below to use as an "yes/no" intro to one of the
calls. It must have aged as is because it complains about badly placed "()s"
right near the top of the intro and I suspect it won't agree with another
line further down either.
Perhaps a hint from the experts as to how to change the problem?
Thank you!
Jason
More information about the freebsd-questions
mailing list