All
I seem to have a problem reading a log file.
The following code seems to produce more output than i ask for.
my $get = "Starting"; open(FH, "$pd_zvkk") || die ("Unable to open pd_zvkk log file: $pd_ +zvkk : !$ \n"); printf STDERR ("My get = $get \n"); foreach (<FH>) { #printf STDERR if /$get/; chomp(); unless($_ !~ /$get/) { printf STDERR ("String = $_ \n"); } }

Then the output i get when i parse a log file is.
[Mon Nov 14 09:54:54 2005] [error] [client 10.142.204.242] My get = St +arting [Mon Nov 14 09:54:54 2005] [error] [client 10.142.204.242] String = Fr +i Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Starting. [Mon Nov 14 09:54:54 2005] [error] [client 10.142.204.242] My get = [Mon Nov 14 09:54:54 2005] [error] [client 10.142.204.242] String = Fr +i Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Starting. [Mon Nov 14 09:54:54 2005] [error] [client 10.142.204.242] String = Fr +i Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Removing old clientac +c files. [Mon Nov 14 09:54:54 2005] [error] [client 10.142.204.242] String = Fr +i Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Running the stored pr +oc. [Mon Nov 14 09:54:54 2005] [error] [client 10.142.204.242] String = [Mon Nov 14 09:54:54 2005] [error] [client 10.142.204.242] String = PL +/SQL procedure successfully completed.
So it is printout out more data than required, can't seem to tell it when you find the result stop and parse it.

In reply to regex log file too many results by minixman

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.