Color regex matches - without dropping misses

后端 未结 7 909
日久生厌
日久生厌 2021-02-07 02:21

When using grep --color=always I can get pretty color highlighting for regex matches.

However, grep only returns lines with at least one match.

7条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-07 02:38

    The simplest solution would be to use egrep --color=always 'text|^' which would match all line beginnings but only color the desired text.

提交回复
热议问题