我想用 sed 过滤一些标准输出,但我不知道如何。标准输出示例是:
.
.
.
Model a. # This should be captured
.
.
.
Metrics results: # This should be captured
==================== # This should be captured
metric 1 # This should be captured
metric 2 # This should be captured
metric 3 # This should be captured
==================== # This should be captured
.
.
.
Model b # This should be captured
.
.
.
Metrics results: # This should be captured
==================== # This should be captured
metric 1 # This should be captured
metric 2 # This should be captured
metric 3 # This should be captured
==================== # This should be captured
.
.
.
其中.
表示包含任何随机字符的行。所以结果是
Model a
Metrics results:
====================
metric 1
metric 2
metric 3
====================
Model b
Metrics results:
====================
metric 1
metric 2
metric 3
====================
我可以使用什么 sed 命令?还将感谢有关如何了解 sed 的解释。