use strict; my $yearMonth = '200907'; my $statistics_file = "url_${yearMonth}.html"; $yearMonth =~ /(\d\d\d\d)(\d\d)/; my $year_month = "$1/$2"; print STDERR $ARGV[1], "\n"; my @total = (); my %url2title = (); open(STDIN, "archives.html"); while (<>) { if (m!(.*)!) { $url2title{$1} = $2; } } close(STDIN); open(STDIN, $statistics_file); open(STDOUT, "> Access${yearMonth}.html"); print< カナダからのブログ アクセス ${year_month}

カナダからのブログ アクセス ${year_month}

END
print "Hits\t\tkBytes\t\tTitle/URL\n";
while (<>) {
    if (m!(\d+)\s+([\d\.]+)%\s+(\d+)\s+([\d\.]+)%\s+(/weblog/\S+(.html|/)|/)\n!) {
	my $nhits = $1;
	my $phits = $2;
	my $nkB = $3;
	my $pkB = $4;
	my $url = $5;
	my $item_year_month = $url =~ m!/(\d\d\d\d/\d\d)/! ? " ($1)" : '';
	print "${nhits}\t${phits}%\t${nkB}\t${pkB}%\t";
	print ($url2title{$url} || $url);
	print "${item_year_month}\n";
	$total[0] += $nhits;
	$total[1] += $phits;
	$total[2] += $nkB;
	$total[3] += $pkB;
    }
}
close(STDIN);
print "\nTotal\n$total[0]\t", int($total[1] + 0.5),
    "%\t$total[2]\t", int($total[3] + 0.5), "%\n";
print<


END
close(STDOUT);