样本文件内容:
display this line
1111 aaaa
1111 aaaa
1111 aaaa
1111 aaaa
don't display this line
1111
1111
The output should be display this line
样本文件内容:
display this line
1111 aaaa
1111 aaaa
1111 aaaa
1111 aaaa
don't display this line
1111
1111
The output should be display this line
uniq -c
is helpful here:问题:如果文件包含
Do you want to output
a
andbbb
?要在三行相同的连续行之后打印行:
要在三行相同的连续行之前打印行:
在扩展正则表达式模式下使用GNU sed:
随时在模式空间中保持3行。继续从模式空间中切掉顶部行,直到我们看到模式空间中的所有3条线都相同,或者碰到我们要关闭并退出的eof。
看来您已经完全改变了问题。 GNU sed