Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jun 2015 16:32:04 -0500
From:      "Lt. Commander" <listmgr@antennex.com>
To:        "'Patrick Hess'" <patrickhess@gmx.net>, <freebsd-questions@freebsd.org>
Subject:   RE: Script question
Message-ID:  <BAY404-EAS3520468CFD04B6982A1487BCCA20@phx.gbl>
In-Reply-To: <2609852.Pc7nSdcYla@desk8.phess.net>
References:  <BAY182-W89C2924F4BDF0D2BD3810DF4BB0@phx.gbl> <BAY404-EAS148D4B304BB066F07E84004CCB90@phx.gbl> <20150615015516.b3ea7633.freebsd@edvax.de> <2609852.Pc7nSdcYla@desk8.phess.net>

next in thread | previous in thread | raw e-mail | index | archive | help
To: freebsd-questions@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@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@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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BAY404-EAS3520468CFD04B6982A1487BCCA20>