【发布时间】:2018-12-14 11:18:41
【问题描述】:
我有一个包含以下几行的大文本文件:
(total drops) 0
(bytes output) 111
(total drops) 1
(bytes output) 222
(total drops) 3
(bytes output) 333
(total drops) 3
(bytes output) 444
(total drops) 5
(bytes output) 555
(total drops) 8
(bytes output) 6666
(total drops) 9
(bytes output) 777
(total drops) 10
(bytes output) 888
(total drops) 20
(bytes output) 999
<<SNIP>>
我想(从顶部开始)打印 2 行,跳过接下来的 2 行并再次打印 2 行,依此类推...期望的输出应该是这样的:
(total drops) 0
(bytes output) 111
(total drops) 3
(bytes output) 333
(total drops) 5
(bytes output) 555
(total drops) 9
(bytes output) 777
(total drops) 20
(bytes output) 999
我尝试了各种 sed/awk 但仍然无法正确...
【问题讨论】:
-
你想做的事情听起来像是一个实现,而不是一个目标。你真正想完成什么?