Ok so how would I use this with all of my .out files. When I run it
by itself it prints Date Status Score
but nothing else even when in the folder with all of the .out files.
When I attempt to give it a file to parse "reportparse.pl *.out) it
gives me the below errors
C:\ESA>reportparse.pl
DateStatus Score
C:\ESA>reportparse.pl c:\esa\ham\
DateStatus Score
Can't do inplace edit: c:\esa\ham\ is not a regular file at C:\ESA\reportparse.p
l line 2.
C:\ESA>reportparse.pl c:\esa\ham\*
DateStatus Score
Can't open c:\esa\ham\*: Invalid argument at C:\ESA\reportparse.pl line 2.
C:\ESA\Ham>reportparse.pl *
DateStatus Score
Can't open *: Invalid argument at C:\ESA\Ham\reportparse.pl line 2.
On Wed, 9 Mar 2005 11:32:47 -0500, Bowie Bailey <[EMAIL PROTECTED]> wrote:
> From: Tim P [mailto:[EMAIL PROTECTED]
> >
> > I am using spamassasin on windows with the ESA message sync (
> > http://www.christopherlewis.com/ExchangeSpamAssassin.htm ) and
> > would like to have some statistics so that I can better tune the
> > spam assassin (particularly with the minimum spam setting and the
> > purge on discovery setting).
> >
> > As perl is already installed what I really need is a perl script
> > that can go through the messages that the ESA dumps out (.out
> > files that can be read by notepad), grab the following lines and
> > dump them into a file format (like a csv or a delimited text
> > file) so that I can use something to give me statistics.
> >
> > X-Spam-Status: Yes, score=28.9
> > Date: Tue, 4 Jan 2005 06:36:10 -0700
> >
> > I would really like to be able to give statistics by date (daily,
> > weekly, monthly), averages, numbers of spams/hams for a time
> > period. Most of that can be done using excel if I have to but
> > its getting that info into a readable fileformat that is beyond
> > me. Anyone out there know how to do something like that?
>
> Parsing the file and producing delimited text that can be imported
> into Excel is simple with Perl.
>
> Assuming that each email scanned will produce both of the lines you
> listed and assuming that those entries are on their own lines and
> not part of a longer line, this should work for you (untested):
>
> print "Date\tStatus\tScore\n";
> while (<>)
> {
>if (/^X-Spam-Status: (Yes|No), score=([0-9.]+)/)
>{
>$status = $1;
>$score = $2;
>}
>if (/^Date: (.*) [-+]\d{5}$/)
>{
>$date = $1;
>}
>if ($status and $score and $date)
>{
>print "$date\t$status\t$score\n";
>undef $date;
>undef $status;
>undef $score;
>}
> }
>
> Output would be tab separated like this (formatted for readability):
>
> DateStatusScore
> Tue, 4 Jan 2005 06:36:10Yes 28.9
>
> Bowie
>