in reply to Re^2: Print line from file only once even if occurrence of pattern is more than once in the line
in thread Print line from file only once even if occurrence of pattern is more than once in the line

Ehm...What's the difference to the question you already asked two weeks ago?

Print 5 lines before and after pattern match from a list

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

PS: Je suis Charlie!

  • Comment on Re^3: Print line from file only once even if occurrence of pattern is more than once in the line (double?)

Replies are listed 'Best First'.
Re^4: Print line from file only once even if occurrence of pattern is more than once in the line (double?)
by jayu_rao (Sexton) on Mar 29, 2015 at 19:11 UTC
    Appreciate everyone's responses so far. The difference is subtle. In my earlier post, the output needed to have 5 lines before and after each occurrence of a pattern but now in this thread, I want the output to have 5 lines before the pattern, the matched line to be printed only once even if there are multiple occurrences of same pattern or different patterns within same line and 5 lines after the matched line. I hope I am able to express the difference.