in reply to How to print the lines immediately above and below a matching line?
TMTOWTDI answer. :-)
Instead of reading the file line by line as suggested in other answers above, you could also read the entire file into a scalar and use a multi line regexp to do it. Look up use of the /m option on regexp matching.
Any Monk who wishes to extend this thread with a complete answer using this method is more than welcome to do so (I'm a bit short of time)
A Monk aims to give answers to those who have none, and to learn from those who know more.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to print the lines immediately above and below a matching line?
by Anonymous Monk on Nov 25, 2012 at 16:33 UTC | |
by roboticus (Chancellor) on Nov 25, 2012 at 18:38 UTC | |
by Anonymous Monk on Nov 25, 2012 at 18:42 UTC | |
by roboticus (Chancellor) on Nov 25, 2012 at 19:16 UTC | |
by Anonymous Monk on Nov 26, 2012 at 09:42 UTC | |
by Kenosis (Priest) on Nov 25, 2012 at 23:48 UTC | |
by Anonymous Monk on Nov 26, 2012 at 09:40 UTC | |
|
In Section
Seekers of Perl Wisdom