i had a post a few days ago asking the best way to parse apache log files. i wasnt able to get apache::parselog to work so i wrote a small script using sed and awk. it produces output like so:
[24/Mar/2004:12:26:52 /manual/misc/perf-tuning.html 0_seconds
[24/Mar/2004:12:27:33 /manual/mod/mod_status.html 0_seconds
[24/Mar/2004:12:27:39 /manual/mod/module-dict.html 0_seconds
[24/Mar/2004:12:27:46 /manual/misc/rewriteguide.html 0_seconds
[24/Mar/2004:12:27:53 /manual/mod/mod_rewrite.html 0_seconds
[24/Mar/2004:12:27:53 /manual/images/mod_rewrite_fig1.gif 0_seconds
[24/Mar/2004:12:27:53 /manual/images/mod_rewrite_fig2.gif 0_seconds
[24/Mar/2004:12:28:05 /manual/new_features_1_3.html 0_seconds
these results are sent to a file for viewing. obviously this isnt the best way to view stats for each file. is there a simple way with perl to parse the file and have the ability to pass a file name as an argument?
i know that i'd have to call the awk script each time to generate a current file which i can do.. but i dont have any ideas how to get perl involved.. is this easy or am i in over my head here?
Edit by tye, escape [
20040327 Edit by BazB: Changed title from 'how do i sort thee?'