How can I make 'grep' show a single line five lines above the grepped line?

后端 未结 4 992
广开言路
广开言路 2020-12-30 19:57

I\'ve seen some examples of grepping lines before and after, but I\'d like to ignore the middle lines. So, I\'d like the line five lines before, but nothing else. Can this b

4条回答
  •  醉梦人生
    2020-12-30 20:28

    This is option -B

       -B NUM, --before-context=NUM
        Print  NUM  lines  of  leading  context  before  matching lines.
        Places  a  line  containing  --  between  contiguous  groups  of
        matches.
    

提交回复
热议问题