#!/usr/local/bin/perl #$Id: italkhist.pl,v 1.1 1999/10/20 03:53:33 itogawa Exp itogawa $ $step = 3; foreach $file (@ARGV) { open IN, ("nkf -e $file|"); while () { if (/^\((\d\d):\d\d:\d\d\)\[([^]].*?)\] (.*)/) { $hour = $1+0; $monkey = $2; $monkey =~ s/(@|¡÷).*//; $chatty{$hour}{$monkey} += ($len = length($3)); $totalchatty{$monkey} += $len; $hist{$hour} += $len; } } close IN; } @monkeys = sort {$totalchatty{$b}<=>$totalchatty{$a}} keys %totalchatty; $cell = 0; $rule = '-'x(7*(24/$step)+21)."\n"; print "handle\\time|"; for($hour = 0; $hour<= 23; $hour += $step) { printf " %02d-%02d", $hour, $hour+$step; } print " | total\n"; print $rule; foreach (@monkeys) { printf "%-10s |", $_; for($hour=0; $hour<=23; $hour++) { $cell += $chatty{$hour}{$_}; if (!(($hour+1) % $step)) { printf "%7d", $cell; $cell = 0; } } printf " |%7d\n", $totalchatty{$_}; } print $rule; print "total |"; $total = 0; for($hour=0; $hour<=23; $hour++) { $cell += $hist{$hour}; $total += $hist{$hour}; if (!(($hour+1) % $step)) { printf "%7d", $cell; $cell = 0; } } printf " |%7d\n", $total;