[Spambayes] my spamstats bash script

Amedee Van Gasse amedee at vangasse.eu
Mon Nov 28 16:17:12 CET 2011


I modified my spamstats shell script, it now also shows the Ham/Spam ratio.

Old version:

#!/bin/sh
#
pkill sb_server.py
(sb_server.py > /dev/null &)
sleep .3
elinks -source http://localhost:8880 | grep am: | html2text | sed 's/ H/\
H/' | sed 's/ S/S/' | column -t
pkill sb_server.py


Output:

Spam:  3215
Ham:   2335



New version:

#!/bin/sh
#
pkill sb_server.py
(sb_server.py > /dev/null &)
sleep .3
SPAM=`elinks -source http://localhost:8880 | grep Spam: | html2text | sed
's/ S/S/' | sed 's/Spam: //' | column -t`
HAM=`elinks -source http://localhost:8880 | grep Ham: | html2text | sed
's/ H/\
H/' | sed 's/Ham: //' | column -t`
pkill sb_server.py
echo "Spam: "$SPAM
echo "Ham: "$HAM
RATIO="scale=3;$HAM/$SPAM"
RATIO=`echo $RATIO | bc -l`
echo "Ham/Spam Ratio: "$RATIO


Output:

Spam: 3215
Ham: 2335
Ham/Spam Ratio: .726


Suggestions are welcome, I'm sure that there are better ways to do this.

-- 
Amedee



More information about the SpamBayes mailing list