On Sat, Mar 18, 2000 at 05:39:26PM +0100, Jens Tautenhahn wrote:
[...]
> to decode email-adresses like
> "Harry =?iso-8859-1?Q?R=FCter?= <[EMAIL PROTECTED]>"
I've added a 'total' output at the end, lowercasing of the Adresses, and
an optional command line parameter to output only matching adresses.
I've also put this script as "mail_from_stats" at
http://sec.42.org/mutt/contrib/
CU,
Sec
--
My biggest problem was when I screwed up the device driver for my eyelids
I couldn't open my eyes to debug them.
#!/usr/local/bin/perl
use Date::Parse;
use POSIX;
use MIME::QuotedPrint;
while (<STDIN>){
chomp;
if ($hdr){
/^Date:\s+(.*)/ && do {$date=$1;};
/^From:\s+(.*)/ && do {$from=$1;};
/^$/ && do {
$hdr=0;
next if( ($#ARGV+1) && !($from =~ /$ARGV[0]/i));
$mail = decode_qp($from);
$mail =~ s/=\?(?:ISO|iso).+?Q\?(.+)\?=/$1/;
$mail = lc($mail);
$HoH{int(str2time($date)/3600/24)}{$mail}++;
$frm{$mail}++;
};
}else{
/^From / && do {$hdr=1; undef $from,$date;};
}
};
foreach $family ( sort {$a <=> $b} keys %HoH ) {
print strftime("%d.%m.%Y: {\n",gmtime($family*60*60*24));
for $role ( sort {$HoH{$family}{$a} <=> $HoH{$family}{$b} } keys %{
$HoH{$family} } ) {
printf "%3d %s\n",$HoH{$family}{$role},$role;
}
print "}\n";
}
print "Totals: {\n";
for $key (sort {$frm{$a} <=> $frm{$b}} keys %frm){
printf "%3d %s\n",$frm{$key},$key;
};
print "}\n";
PGP signature