如何从排序输出中排除唯一行?
我们说我有以下文字:
aa
ab
ax (NOT dupplicated line)
aa
aa
ab
az (NOT dupplicated line)
ay (NOT dupplicated line)
我希望从中删除非重复的行:
aa
aa
aa
ab
ab
我如何使用sort
?
答案 0 :(得分:5)
将sort
与uniq
:
command | sort | uniq -D
-D, --all-repeated[=delimit-method]
打印所有重复的行delimit-method = {none(默认),prepend,separate}用空行完成分隔