From a related question asked by Bi, I\'ve learnt how to print a matching line together with the line immediately below it. The code looks really simple:
It will probably be easier just to use grep for this as it allows printing of lines before and after a match. Use -B and -A to print context before and after the match respectively. See http://ss64.com/bash/grep.html