Problems? Is your data what you think it is? | |
PerlMonks |
Re: Printing line before matching expressionby johngg (Canon) |
on Sep 10, 2013 at 23:52 UTC ( [id://1053383]=note: print w/replies, xml ) | Need Help?? |
You have to keep a buffer of previously read lines large enough to retain the nth previous line you are wanting to print. How to handle the situation where there aren't n lines before your found line is an exercise left to the reader.
I hope this is helpful. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|