tim*_*eon 110 linux text duplicates
如果我有一个带有以下内容的文本文件
red apple
green apple
green apple
orange
orange
orange
是否有可用于获得以下结果的Linux命令或脚本?
1 red apple
2 green apple
3 orange
bor*_*ble 208
发送它sort(将相邻的项目放在一起)然后uniq -c给出计数,即:
sort filename | uniq -c
并且可以按排序顺序(按频率)获取该列表
sort filename | uniq -c | sort -nr
小智 48
几乎borribles',但如果添加相同的d参数去uniq那只能说明重复.
sort filename | uniq -cd | sort -nr