#!/usr/athena/bin/perl

while(<>){
	&report if($ARGV ne $arg);
	$arg = $ARGV;
	chop;
	($h, $p) = split(":", $_);
	@dom = split(/\./, $h);
	$tdom = $dom[$#dom];
	$count{$tdom}++;
}
$arg = $ARGV;
&report;
sub report {
	return unless defined %count;
	@topdoms = sort {$count{$b} <=> $count{$a};} keys %count;
	($s, $when, $hm) = split(/\./, $arg);
	for $d (@topdoms){
		$perc = int((100*$count{$d}/$hm)+.5);
		print("$when $d $count{$d} $perc\n");
	}
	%count=();
}
