![]() |
|
Keep It Simple, Stupid | |
PerlMonks |
Parsing a log fileby Anonymous Monk |
on Jul 12, 2000 at 23:54 UTC ( [id://22262]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello fellow monks. I'm attempting to parse a log file that looks like the following excerpt (the actual size is thousands of lines long):
#Software: Microsoft Internet Information Server 4.0 I understand how to open files and read individual lines from the file, and how to format the output, but I'm stuck on the parsing of individual sections of the line. What I specifically am interested in is counting up every file type (eg- .gif, .html, .jpg) AND the times each file type has a unique code (eg- 304, 200, 202). So for the above snippet the output would look something like:
Of course, I would need to ignore any lines that did not have these codes (eg- the header lines). I've considered that using an array might be the best solution, but am lost on the algorithm necessary to achieve this. Thanks for any help or ideas in the right direction. -bri-
Back to
Seekers of Perl Wisdom
|
|