#!/usr/local/bin/perl

# $Header: /afs/sipb.mit.edu/project/dec-charon/mail-server/RCS/count-sent-files.pl,v 1.2 1993/09/22 18:50:43 jik Exp $

while (<>) {
    @_ = split(' ', $_, 2);
    if ((@_ == 2) && ($_[0] =~ /^send$/i)) {
	$_[1] =~ s/(\.Z|)\s*\n//;
	$sent{$_[1]}++;
    }
    elsif ($_[0] =~ /^From$/) {
	@_ = split(' ', $_[1]);
	if (($newday = "$_[2] $_[3]") ne $oldday) {
	    $oldday = $newday;
	    print STDERR "$oldday\n";
	}
    }
}

while (($file, $count) = each %sent) {
    $output{$count} .= "$count\t$file\n";
}

for (reverse sort { $a <=> $b; } keys %output) {
    print $output{$_};
}
