Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
To get the next line after a line ending in 0.00,
if (my @lines = grep{/^\d+.*\s*0\.00\s*$/}@data) change to: if (my @lines = grep{/^\d+.*\s*0\.00\s*$/..././}@data)
Perl grep is a very powerful critter! What the above says is to filter lines from @data. If the condition in the grep is true, make a copy of the line in @lines. The regex in the grep means: True if we are inbetween a line starts with a digit and ends with 0.00 and another line containing any character at all. The 3 dots means that this "any character" has to be on a separate line. So this will print the line ending in 0.00 and the next line whatever it has, which from your data format happens to be this N347 stuff! Pretty cool!

As like before, I deleted some of the characters so that the output wouldn't word wrap.

NAME DOE, JOHN ..... ASG Y MOA MA01 MA18 12351141821118 ..... CO-18 31.00 0.00 N347 12351141821118 ..... CO-18 199.00 0.00 N347 12351141821118 111809 CO-18 182.00 0.00 N347 ADJ TO TOTALS: PREV PD INTEREST ... 84.25
I wish you well on your Perl learning adventure! Perl is certainly not considered a beginning language. So you are starting in a hard place. You will need a number of books, perhaps start with "Learning Perl".

In reply to Re^3: Regex Not Grabbing Everything by Marshall
in thread Regex Not Grabbing Everything by JonDepp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-28 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found