#!/usr/local/bin/perl # reads in your procmaillog (mine actually) # and removes all items in it that are # "uninteresting", which means either # (a) message went through to /var/spool/mail # (b) message was from ME. # # procmailcheck.p $padder="----------\n" ; $file = "/home/mackay/procmaillog" ; eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; $mailer_mail = 0 ; $interesting = 1 ; $current = 0 ; open(O ,"<$file") ; while() { $i ++ ; # print $i ; if (/^From/) { if ($current && $interesting) { # spit out last thing print $padder, $log[$current] ; $interestingtot ++ ; } $current++ ; $interesting = 1 ; if (/^From mackay\@mrao.cam.ac.uk/ ) { $interesting = 0 ; $boringtot ++ ; } } if ( /Folder: \/var\/spool/ ) { $interesting = 0 ; $boringtot ++ ; $incoming ++ ; } if ( /Folder: mailer_mail/ ) { $mailer_mail++ ; } $log[$current] .= $_ ; } printf STDERR "%s %d interesting (of which %d failed mail) and %d boring things (%d incoming)\n" , $padder , $interestingtot , $mailer_mail , $boringtot , $incoming ; print " cat $file >> $file.bak\n" ;