更新时间:2023-12-01 11:58:04
假设每行有一个数字:
sort <file> | uniq -c
您也可以在 GNU 版本中使用更详细的 --count 标志,例如在 Linux 上:
--count
You can use the more verbose --count flag too with the GNU version, e.g., on Linux:
sort <file> | uniq --count
在文件中查找重复的行并计算每行重复的次数?
查找并保留文本文件中的所有重复行(而不是唯一行)