On Fri, Feb 22, 2002 at 03:18:54PM -0600, Mark Roedel wrote:
> One of these days I'll get annoyed enough with it to write something
> more elegant in Perl to do the same thing in a single pass through the
> logfile, but for now it gets the job done.

I spent a few minutes this afternoon writing up a "works for me" script.
Give it a folder of spams for input and it'll spit out the stats as such:

$ spam-scores mail/spammers
  0.0 -   4.9: 123
  5.0 -   9.9: 215
 10.0 -  14.9: 225
 15.0 -  19.9: 224
 20.0 -  24.9: 150
 25.0 -  29.9: 74
 30.0 -  34.9: 24
 35.0 -  39.9: 5
 40.0 -  44.9: 3


################
#!/usr/bin/perl -w
$|++;
use strict;

my $value = 5.0;
my %storage = ();

while(defined($_=<>)) {
        next unless /^X-Spam-Status:/;
        my($hits) = /\bhits=(?:3D)?(\d\S*)\s/;
        next unless $hits;
        $storage{int($hits/$value)} ++;
}

my $low = ( sort { $a <=> $b } keys %storage )[0];
my $high = ( sort { $b <=> $a } keys %storage )[0];
for( my $i = $low; $i <= $high; $i++ ) {
        my($num) = defined $storage{$i} ? $storage{$i} : 0;
        printf "%5.1f - %5.1f: %d\n", ($value*$i), ($value*($i+1))-.1, $num;
}
################

-- 
Randomly Generated Tagline:
"The way of the warrior is one of peace interrupted by an occasional
 unavoidable ass-kicking."            - unknown

_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to