KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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 file1:line4 file1:line5 file1:line6 </blank line> file2:line1 file2:line2 file2:line3 file2:pattern file2:line4 file2:line5 file2:line6 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. also note that adding a new blank line after every bb+aa+1 line won't work because what if a file has less than bb lines before the pattern.
Tags (comma-separated)
Save Edits
Cancel