You've said you know how to read the files and get the lines etc. so I'm just going to do the other bits.
First you want to split the data to extract the path to the file and the number at the end. You can use split to do this:
my @bits = split ' ', $line;
This will give you and array with the path to the file in $bits[3] and the number in $bits[4]. Next you must extract the file type from the path to the file.
$bits[3] =~ s/\.(\w+)$/$1/;
I would then use a hash to store these:
$count{$bits[3]}{$bits[4]}++;
The first time you reference a type/ number combination it will be created with a value of one, each time after that the number gets incremented and so it keeps a count of how many times each combination occurred. At the end of the script you can get the data with:
foreach $type (keys %count) { foreach (keys %count{$type}) { print "$type $_ $count{$type}{$_}"; } }
Nuance
In reply to Re: Parsing a log file
by nuance
in thread Parsing a log file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |