How to easily print line above the match and skip the match itself? grep -A, -B and -o opt do not solve it. Maybe some
grep
-A
-B
-o
awk '/foo/{print a}{a=$0}' your_file