A "trick" for reading reguarly formated material like this is to change the input seperator to the header string for each block. Consider:

use strict; use warnings; $/ = '0AVERAGE COMPOSITION IN PINS.'; while (<DATA>) { next if ! /EID: Pu-238/; chomp; print "$/$_"; } __DATA__
0AVERAGE COMPOSITION IN PINS. NUMBER DENSITIES IN 1.0E+24/CM3, WT% P +ER MASS INITIAL HEAVY ISOTOPES. ---------------------------- FOR BA-ELEMENTS WITH EID>99100, WT% IS +THE PERCENTAGE LEFT (FRACTION). 0 EID: Cm-243 ND : 8.7352E-08 0 0 3822 0 3278 0 0 3260 0 +++ 0 3242 0 +++ +++ 0 3157 0 0 0 +++ 0 3096 0 0 0 +++ +++ 0 3170 0 0 0 0 0 0 0 3772 3170 3096 3157 3242 3260 3278 3822* 0 0 0 0 0 0 0 0 0 0 1GE 12 Bundle VOID=0% + >> PHOENUT /1.2.8 / << CORE MASTER 9 COMPOS CASE= 1 RP= 5 V= 2.9 CO= 0 B= 3307 + 2007-01-30 13.38.50 Page 668 Job0000 0AVERAGE COMPOSITION IN PINS. NUMBER DENSITIES IN 1.0E+24/CM3, WT% P +ER MASS INITIAL HEAVY ISOTOPES. ---------------------------- FOR BA-ELEMENTS WITH EID>99100, WT% IS +THE PERCENTAGE LEFT (FRACTION). 0 EID: Pu-238 ND : 7.0913E-06 1 1 3667 0 3283 0 0 3266 0 +++ 0 3250 0 +++ +++ 0 3192 0 0 0 +++ 0 3151 0 0 0 +++ +++ 0 3204 0 0 0 0 0 0 1 3630 3204 3151 3192 3250 3266 3283 3667* 1 1 0 0 0 0 0 0 1 1 1GE 12 Bundle VOID=0% + >> PHOENUT /1.2.8 / << CORE MASTER 9 COMPOS CASE= 1 RP= 5 V= 2.9 CO= 0 B= 3307 + 2007-01-30 13.38.50 Page 669 Job0000

Prints:

0AVERAGE COMPOSITION IN PINS. NUMBER DENSITIES IN 1.0E+24/CM3, WT% P +ER MASS INITIAL HEAVY ISOTOPES. ---------------------------- FOR BA-ELEMENTS WITH EID>99100, WT% IS +THE PERCENTAGE LEFT (FRACTION). 0 EID: Pu-238 ND : 7.0913E-06 1 1 3667 0 3283 0 0 3266 0 +++ 0 3250 0 +++ +++ 0 3192 0 0 0 +++ 0 3151 0 0 0 +++ +++ 0 3204 0 0 0 0 0 0 1 3630 3204 3151 3192 3250 3266 3283 3667* 1 1 0 0 0 0 0 0 1 1 1GE 12 Bundle VOID=0% + >> PHOENUT /1.2.8 / << CORE MASTER 9 COMPOS CASE= 1 RP= 5 V= 2.9 CO= 0 B= 3307 + 2007-01-30 13.38.50 Page 669 Job0000

DWIM is Perl's answer to Gödel

In reply to Re: REGEX on multiple lines by GrandFather
in thread REGEX on multiple lines by igotlongestname

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.