Discussion:
[jdashiel@shellworld.net: spt.sh script]
Ed Allen
2014-02-23 16:14:34 UTC
Permalink
----- Forwarded message from Jude DaShiell <***@shellworld.net> -----

For any using spamassassin below is a script you can use to automate
blacklisting of the undesireables sending spam. I'm sending this to the
list since it represents a use of sed and may be useful to others on this
list too.
cut here.
#!/usr/bin/env bash
# file: spt.sh - handle today's blacklist entries.
cd $HOME
grep "^From:" $HOME/mail/probably-spam | cut -d \ -f 1-8 - >up3
sed -i -e 's/^/blacklist-/' up3
echo "adding `wc -l up3` new senders to blacklist"
cat up2 up3 >up4
sort up4 | uniq >up5
cp up5 up4
cat up1 up4 >up0
cp up0 .spamassassin/user_prefs
rm up3
cp up4 up2
rm up4

jude <***@shellworld.net>


----- End forwarded message -----

What initially filled up2 ?

Without it 'cat up2 up3 >up4' becomes a rename.

Ed Allen
Cameron Simpson
2014-02-23 21:47:07 UTC
Permalink
Post by Ed Allen
For any using spamassassin below is a script you can use to automate
blacklisting of the undesireables sending spam. I'm sending this to the
list since it represents a use of sed and may be useful to others on this
list too.
cut here.
#!/usr/bin/env bash
# file: spt.sh - handle today's blacklist entries.
cd $HOME
grep "^From:" $HOME/mail/probably-spam | cut -d \ -f 1-8 - >up3
sed -i -e 's/^/blacklist-/' up3
echo "adding `wc -l up3` new senders to blacklist"
cat up2 up3 >up4
sort up4 | uniq >up5
cp up5 up4
cat up1 up4 >up0
cp up0 .spamassassin/user_prefs
rm up3
cp up4 up2
rm up4
----- End forwarded message -----
What initially filled up2 ?
Without it 'cat up2 up3 >up4' becomes a rename.
Earlier runs of this script filled it.

There are many many things that should be changed in this script,
but that particular piece of logic is not one of them:-)
--
Cameron Simpson <***@zip.com.au>

Who are all you people and why are you in my computer? - Kibo
Loading...