【问题标题】:Bash: exclude unique lines from output [closed]Bash:从输出中排除唯一行[关闭]
【发布时间】:2015-11-15 22:56:39
【问题描述】:

如何从排序输出中排除唯一行?

假设我有以下文本:

aa
ab
ax    (NOT dupplicated line)
aa
aa
ab
az    (NOT dupplicated line)
ay    (NOT dupplicated line)

我想从中删除不重复的行:

aa
aa
aa
ab
ab

我将如何使用sort

【问题讨论】:

标签: bash


【解决方案1】:

sortuniq 一起使用:

command | sort | uniq -D
-D, --all-repeated[=delimit-method]

打印所有重复行 delimit-method={none(default),prepend,separate} 用空行分隔

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-22
    • 1970-01-01
    • 1970-01-01
    • 2012-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多