Add blank line after every result in grep

前端 未结 7 1995
北荒
北荒 2020-12-14 18:24

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         


        
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 18:50

    Pipe | any output to:

    sed G
    

    Example:

    ls | sed G
    

    If you man sed you will see

    G Append's a newline character followed by the contents of the hold space to the pattern space.

提交回复
热议问题