Print line, which is situated 2 lines before the match(pattern).
I tried next:
sed -n \': loop /.*/h :x {n;n;/cen/p;} s/./c/p t x s/n/c/p t loop {g;p
This one with grep, a bit simpler solution and easy to read [However need to use one pipe]: grep -B2 'pattern' file_name | sed -n '1,2p'
grep -B2 'pattern' file_name | sed -n '1,2p'