Hi,

On Tue, 24 Aug 2004 20:32:03 -0500 "Jack L. Stone" <[EMAIL PROTECTED]> wrote:

> This script will give you a list of all rules and times hit in ascending
> order. For different analysis, I run it for the month, week & day to see
> the shifts in rules hit, and new ones being hit.
> 
> Here's the script -- I grabbed it from this list I think and don't know who
> to give credit for it:
> 
>   #!/bin/sh
>   DEFFILES="/usr/local/etc/mail/spamassassin/*.cf"
>   GREPSTR="describe"
> 
>   cat $DEFFILES | egrep ^$GREPSTR  \
>      | awk '{ print "echo `fgrep " $2 " /path/to/spamboxes.* \
>      | wc -l` " $2 } ' | sort | uniq | tail +2 | sh | sort -rn

I expanded on this a little with the attached script. The above is fine
for use against mbox files but not so helpful if you use mh folders (I
like "one message, one file" because there's less to corrupt, and
searching is a bit easier)

Note that analysing large mh folders will take a while (this naive
searching is O[mn] where m is the number of messages and n is the number
of rules - it took 14 hours to search 10000 messages for 4400 rules (44
million file reads on a dual 800MHz P-III.) A better way to do this is
to parse just the message headers and record found rules in a hash.

hth,

-- Bob

Attachment: spamrulescan.sh
Description: Bourne shell script

Reply via email to