This might form a starting point. You'll to tweak the regexes in the light of what the rest of the logs look like and add extra if you want to record timings, offsides etc.

#! perl -slw use strict; use Data::Dumper; #local $/ = ''; my %stats; while( $_ = <DATA> ) { chomp; $stats{$1}{$2}{$3} += $4 if m[ ([A-Z]{3}) \s+ # Team ( \d{2}\s[A-Za-z]+ ) \s+ # Player (ran|kicked|pass completed|returned) # Action .*? (\d+)\syards? ]x; $stats{$2}{$3}{$1}++ if m[ (Tackled|assisted|block) #action .*? by\s+([A-Z]{3}) \s+ # Team ( \d{2}\s[A-Za-z]+ ) # Player ]x; } print Dumper \%stats; __DATA__ Beginning of First Quarter. ORL 13 Sauls kicked off 71 yards from the ORL30. ASH 22 Noa returned the ball 14 yards to the ASH13. Tackled by ORL 82 Ferguson. Possession to Asheville. 1-10-ASH13 (14:30) ASH 48 Hopper ran around right end for 1 yard. Tackled by ORL 94 Whiting, assisted by ORL 54 Schacht. 2-09-ASH14 (13:59) ASH 23 Theriot ran inside the left guard for 1 ya +rd. Tackled by ORL 96 Dugger. 3-08-ASH15 (13:25) ASH 18 Hall pass completed to 23 Theriot for 10 y +ards. Tackled by ORL 96 Dugger. -- 1-10-ASH25 (12:50) ASH 38 Dollinger ran around right end for 6 yards +. Tackled by ORL 95 Gonzalez, assisted by ORL 54 Schacht. Key block delivered by ASH 77 Cassell. 2-04-ASH31 (12:05) ASH 18 Hall pass was overthrown, intended for 81 +Perry. Penalty: ORL - Offsides. --

Output

[19:23:58.26] P:\test>410999 $VAR1 = { 'ASH' => { '77 Cassell' => { 'block' => 1 }, '38 Dollinger' => { 'ran' => '6' }, '23 Theriot' => { 'ran' => '1' }, '48 Hopper' => { 'ran' => '1' }, '22 Noa' => { 'returned' => '14' } }, 'ORL' => { '95 Gonzalez' => { 'Tackled' => 1 }, '94 Whiting' => { 'Tackled' => 1 }, '96 Dugger' => { 'Tackled' => 2 }, '82 Ferguson' => { 'Tackled' => 1 }, '13 Sauls' => { 'kicked' => '71' } } };

Examine what is said, not who speaks.
"But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
"Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

In reply to Re: Parsing a Log File by BrowserUk
in thread Parsing a Log File by PrimeLord

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.