I\'ve learnt how to grep lines before and after the match and to grep the last match but I haven\'t discovered how to grep the last match
grep
using awk instead:
awk '/pattern/{m=$0;l=NR}l+1==NR{n=$0}END{print m;print n}' foo.log
small test, find the last line matching /8/ and the next line of it:
/8/
kent$ seq 20|awk '/8/{m=$0;l=NR}l+1==NR{n=$0}END{print m;print n}' 18 19