Hi there, I have a log file which looks like this:-
Software Package: "MS08-056_KB956464-Officexp_W2K_ENU.1.0.1.0" Operation: install Mode: not-transactional,not-undoable | force | notify_inv +entory Time: 2008-10-28 08:23:52 Log File: catrsts010bns3a:e:\logs\MS08-056_KB956464-Officexp_ +W2K_ENU.1.0.1.0.log ================= DISSE0074I Operation successfully submitted. Distribution ID is 184743 +9935.229087. ================= Software Package: "MS08-056_KB956464-Officexp_W2K_ENU.1.0.1.0" Operation: install Mode: not-transactional,not-undoable | force | notify_inv +entory Time: 2008-10-28 08:38:42 Log File: catrsts010bns3a:e:\logs\MS08-056_KB956464-Officexp_ +W2K_ENU.1.0.1.0.log ================= TEST: DISSE0155I Distribution ID: `1847439935.229087' DISSE0029I Current software package status is 'IC--E'. DISSE0005E Operation unsuccessful. DISSE0442I Execution of user program 'during_install - C:\Staging\MS08 +-056_W2K_ENU.1.0.1.0\setup.exe (/s)' completed with result: 'success' +. DISSE0198I User program exit code: 0 DISSE0111E Unable to remove the path C:\Staging\MS08-056_W2K_ENU.1.0.1 +.0. Errno: 2089877656. =================
I want to split it by ================= and then if the 4th line of a block is DISSE0029I Current software package status is 'IC--E' then add the first line of the block in an array, if not ignore that block. Your help will be greatly appreciated. This output of the log file will be:
TEST:

In reply to File parsing by green_lakers

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.