App::Ack and grep can do that out of the box, just pass -C3 as a command line option to either.
In reply to Re: printing several lines around match
by moritz
in thread printing several lines around match
by auto_w
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |