Hi, I posted something similar last week but didn't properly explain what I needed to do and
I still can not figure it out. I have an application log I'm trying to retrieve a specific sequence of 4 lines
from(event1,event2,event3, event4). I've successfully filtered the log to get all occurances the four lines
but now only want to pull out the blocks of lines where the events occur in sequence.
EX:

09:12:50:861 EVENT1 #discard
09:13:09:467 EVENT2 #discard
09:13:09:837 EVENT1 #keep
09:13:38:059 EVENT2 #keep
09:14:03:115 EVENT3 #keep
09:14:04:076 EVENT4 #keep
09:14:11:376 EVENT1 #discard
09:14:34:049 EVENT2 #discard
09:14:34:990 EVENT3 #discard
09:14:34:990 EVENT3 #discard
09:14:34:990 EVENT4 #discard
09:15:09:837 EVENT1 #keep
09:16:38:059 EVENT2 #keep
09:17:03:115 EVENT3 #keep
09:18:04:076 EVENT4 #keep

I want to extract the data when the four events happen in an unbroken sequence and print them to a file
Can anyone help me? I'm fairly new to Perl and development in general.
Thanks again!

In reply to Log Parsing Help by dlcasey

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.