in reply to Pattern Matching

I'd just reuse existing code, and use grep -C 1 'PATTERN' file.

grep has been ported to Windows as well.