I am trying to extract parts of a text log file. The format is kind of fixed, I can always write code to retrieve the important parts, but I am trying to look for a generic way - or a framework that already does this.

I am looking for something simple and lightweight.

In case the requirement is not clear, the log file has a format like:

my_header (.*) ... time: (.*) ... [error: (.*)] ... status: (.*) ... end_signature

Basically, this contains some lines that may be matched (those enclosed in []s) and some lines that must be matched (those not). Also, it would be interesting if there is a way to specify that the some line need not be at any given location.

If anyone has any pointers on how I can achieve this, I would really appreciate it.

Thanking you in advance,
Hemanth

In reply to Log File Extracter by hemanthc

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.