我需要带有上下文、颜色和空白行作为组分隔符的 grep 输出。在这个问题中,我学会了如何定义 custom group-separator
,并且我已经像这样构建了我的 grep 命令:
grep --group-separator="" --color=always -A5
Run Code Online (Sandbox Code Playgroud)
但组分隔符实际上不是空的,而是仍然包含颜色代码(即[[36m[[K[[m[[K
)。这是因为我正在使用--color=always
. 但是我需要在我的 grep 命令中使用颜色,并且我需要将分隔符设为空行(以便进一步处理)
我怎样才能结合这两个条件?