in reply to Dealing with nextline of a file
The sliding window concept is a generic way to solve such "n'th line before" , "x'th line after" requirements.
See Re^2: Grab 3 lines before and 2 after each regex hit (sliding window) and especially the code in the "update".
NB the window size in your example is just 2 then.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|