my grep command looks like this zgrep -B bb -A aa \"pattern\" *
I would lke to have output as:
file1:line1
file1:line2
file1:line3
file1:pattern
file
The problem is that its hard to distinguish when lines corresponding to the first found result end and the lines corresponding to the second found result start.
Note that although man grep says that "--" is added between contiguous group of matches. It works only when multiple matches are found in the same file. but in my search (as above) I am searching multiple files.
If you don't mind a --
in lieu of a </blank line>
, add the -0
parameter to your grep
/zgrep
command. This should allow for the --
to appear even when searching multiple files. You can still use the -A
and -B
flags as desired.