in reply to Print 5 lines before and after pattern match from a list

maybe of interest: Re^2: Grab 3 lines before and 2 after each regex hit (sliding window)

especially the updated code shows a very flexible and generic solution.

edit

and since nobody seems to have mentioned it here before: Your praxis to use $_ as outer loop-var is prone to very hard to find ugly bugs.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)

PS: Je suis Charlie!

  • Comment on Re: Print 5 lines before and after pattern match from a list