Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Print specific data based on regex search in previous line

by Anonymous Monk
on May 08, 2018 at 11:53 UTC ( #1214203=note: print w/replies, xml ) Need Help??


in reply to Print specific data based on regex search in previous line

It is useful to look at various tutorials describing the command-line tool awk (which was actually one of the early inspirations for Perl ...) to see how problems like these can be handled in-general. (Awk is so similar to Perl that there actually exists an a2p tool which will generate a Perl equivalent to an awk program. Such a program basically consists of a series of regular-expression patterns, each accompanied by code that is to be executed when that pattern is matched. The Perl solution previously posted in this thread is much the same well-proved approach. Some of the lines-of-interest will capture data for later use, while other lines-of-interest (and perhaps, end-of-file) will cause output to be generated.
  • Comment on Re: Print specific data based on regex search in previous line

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1214203]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2019-10-22 06:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?