#!/afs/athena/contrib/perl/p

$nopt = $ARGV[0];
$nopt = 10 if !$nopt;
$max = $ARGV[1];
$max = 5 if !$max;
open(LOG, "rsh charon cat /var/local/www/logs/log|") || die "Can't open rsh to charon";

printf("%50s %s\n",'Request','#');
printf("%50s %s\n",'--------','---');
while(<LOG>){
    split;

    if(substr($_[0], 0, 1) ne '-'){
	$host{$_[$nopt]}++;
    }
}
       @list = sort byvalue keys %host;
       for $host (@list){
	   if($host{$host} > $max){
	       printf("%50s %d\n",$host,$host{$host});
	   }
       }

sub byvalue {
    $host{$b} <=> $host{$a};
}
