Hello all!

I am new to perl (started about a week ago) and have already found a new home. Now I have a bit of a problem, that I cannot really figure out how to do it. It feels like it is on the tip of my toungue, but I just can't get it.

I am trying to parse a logfile and create a report from it. I am not sure how to do this. Regexp to match the lines?

Here is a line from the log:
2012-06-01 16:04:46,395 Thread-12796 - Dispatcher thread #1 INFO JMasterProtocol - JMasterProtocol.getMasterPushExitInstance: Asked exit instance for target 'SPF0055R' from dispatcher

First I need to search for the SPF0055R to get the Tread number. Then put the thread number into a variable and then search the file again for the thread number and insert other variables, but only from lines that has the same thread number.

So far all I have is:
open (FILEPTR,$file) || die "Cant open file"; @trace <FILEPTR>;
After that I am not sure what to do? Can someone please point me in the right direction?

In reply to Parsing a logfile. by concept

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.