#!/usr/bin/perl -w foreach () { next if /^#/; # Oops! Forgot this the first time :( my @results = split; $type = $1 if $results[3] =~ /(\.\w+)$/; $code = $results[4]; $output{$type}{$code}++; } foreach $type_key (keys %output) { foreach $code_key (keys %{$output{$type_key}}) { print "$type_key\t$code_key\t$output{$type_key}{$code_key}\n"; } } __DATA__ 00:00:29 192.168.20.50 GET /Plastic/ProductTop.html 200 00:00:29 192.168.20.50 GET /Plastic/images/ProductNavTopRt.jpg 304 00:00:29 192.168.20.50 GET /plastic/ProductNav.html 200 00:00:29 192.168.20.50 GET /plastic/images/ProductNav1b.jpg 304 00:00:29 192.168.20.50 GET /main.html 202 #### .html 200 2 .html 202 1 .jpg 304 2