I've a file to parse.

Here's a sample of its contents (this is cat -vue's output, and there are many more "sections" like the ones below in that file. about 12,000 sections like the ones below. I masked IPs, so if you see "x.x.x.x" there used to be an IP there :) ):

----- cut here ----- abc1-wl-wlc2.domain.com$ $ Successful downloads: 0$ Failed downloads: 1$ Warnings: 0$ $ Detailed Log Info$ $ General Expect Errors: 1$ Text Dump Failure: 1$ Binary Transfer Successful: 1$ Attempts to get Text Dump: 1$ Attempts to use TFTP: 1$ Attempted binary transfers: 1$ $ Textual log of the file transfer:$ Processing abc1-wl-wlc2.domain.com Performing [/usr/bin/ssh -2 -a -o " +StrictHostKeyChecking no" abc1-wl-wlc2.domain.com] Exception: 3:Child + PID 20855 exited with status 256 at /usr/SD/perl-5.6.1/lib/site_perl +/ EMAN/Config/DeviceConfig/WLC.pm line 288, line 58. ExpectLog: Sorry, t +elnet is not allowed on this port!Connection to abc1-wl-wlc2.domain.c +om closed. Performing TFTP using SNMP: DestHost [x.x.x.x] Commu nity [tasMANia] agentTransferUploadServerIP [x.x.x.x] agentTransferUpl +oadFilename [x.x.x.x.UCFM.18441] Exception: 3:Child PID 20855 exited +with status 256 at /usr/SD/perl-5.6.1/lib/site_perl/EMA N/Config/DeviceConfig/WLC.pm line 288, line 58. Updating CVS$ $ apl02-wl-wlc1.domain.com$ $ Successful downloads: 0$ Failed downloads: 1$ Warnings: 0$ $ Detailed Log Info$ $ Failed Binary transfers: 1$ General Expect Errors: 1$ Text Dump Failure: 1$ TFTP failures due to SNMP set error: 1$ Attempts to get Text Dump: 1$ Attempts to use TFTP: 1$ Attempted binary transfers: 1$ $ Textual log of the file transfer:$ Processing apl02-wl-wlc1.cisco.com Performing [/usr/bin/ssh -2 -a -o " +StrictHostKeyChecking no" apl02-wl-wlc1.cisco.com] Exception: 3:Child + PID 20683 exited with status 256 at /usr/SD/perl-5.6.1/lib/site_perl +/EMAN/Config/DeviceConfig/WLC.pm line 288, line 56. ExpectLog: Sorry, + telnet is not allowed on this port!Connection to apl02-wl-wlc1.cisco +.com closed. Performing TFTP using SNMP: DestHost [64.101.206.133] Co +mmunity [private] agentTransferUploadServerIP [171.70.168.173] agentT +ransferUploadFilename [64.101.206.133.UCFM.18436] Exception: Could no +t initialise SNMP [Timeout] at /usr/SD/perl-5.6.1/lib/site_perl/EMAN/ +Config/DeviceConfig/WLC.pm line 450, line 56. Exception: 3:Child PID +20683 exited with status 256 at /usr/SD/perl-5.6.1/lib/site_perl/EMAN +/Config/DeviceConfig/WLC.pm line 288, line 56. Could not initialise S +NMP [Timeout] at /usr/SD/perl-5.6.1/lib/site_perl/EMAN/Config/DeviceC +onfig/WLC.pm line 450, line 56. at /usr/SD/perl/lib/site_perl/EMAN/Co +nfig/Download.pl line 888 at /usr/SD/perl/lib/site_perl/EMAN/Config/D +ownload.pl line 888$ $ ----- cut here -----

The task at hand is as follows: I need to come up with a multiline regex that matches everything between "abc1-wl-wlc2.domain.com" and "apl02-wl-wlc1.domain.com", so I can process the contents of that file, section by section. if it helps any, I'm mainly interested in getting a list of hostnames that have a "Failed Binary transfers: 1" in their section..

Any thoughts / suggestions on the multiline?

I tried doing it on my own, but unfortunatelly without much success.. I know about the "m" modifier on the end of my regex, btw. I'm not completely useless, but I can't seem to craft the necessary regex for this task :/


In reply to Multi-line regex help needed by vxp

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.