As Unix does not offer -A
or -B
options with grep, I am looking for the way to achieve the same result in Unix.
The purpose is to print all the lines not starting with a specific pattern and the preceding line.
grep -B1 -v '^This' Filename
This will print all the lines not starting with the string 'This'
and the preceding line. Unfortunately my script needs to be run on Unix.
Any workaround will be great.