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

$min = $ARGV[0] if $ARGV[0];

open(LOG, "rsh charon cat /var/local/www/logs/log|") || die "Can't open rsh to charon";

printf("%40s (%14s) %s\n",'Hostname','IP Address', '#');
printf("%40s (%14s) %s\n",'--------','--------------', '---');
while(<LOG>){
    split;

    $_[1]=substr($_[1], 1);
    if(substr($_[0], 0, 1) ne '-'){
	$host{$_[1]}++;
	$name{$_[1]}=$_[0];
    }
}
       @list = sort byvalue keys %host;
       for $host (@list){
	   $name{$host} =~ tr/A-Z/a-z/;
	   if($host{$host} > $min){
	       printf("%40s (%14s) %d\n",$name{$host},($host),  $host{$host});
	   }
       }

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