#!/bin/bash # # Check and clean black.lst file from SpamBouncer. BL=/home/curson/mail/.pm/black.lst BLTEMP=/home/curson/mail/.pm/black.lst.temp # This will strip the username from the email address leaving only the domain. perl -i -p -e 's/[0-9A-Za-z_\.]*@//gi' $BL # This will strip common domain name that could have been inserted into the # black list due to fake TO: fields. perl -i -p -e 's/^the-shrike\.net\n|^ussleonardo\.net\n|^gmail\.com\n|^yahoo.+\n|^email\.it\n|^mail.+\n//gi' $BL # This will strip out all double recurrencies in the file. perl -ne 'print unless $a{$_}++' $BL > $BLTEMP | mv $BLTEMP $BL # Now let's do a backup of the black.lst file. cp $BL /home/curson/mail/.pm/black.lst.backup