测试数据:
[[email protected]][/tmp]$ cat msn.txt aaa bbb bbb ccc ccc ddd bbb eee aaa ccc bbb sss
option:-w,只比较每行的前几个字符
注意:为了使uniq起作用,所有的重复行必须是相邻的
[[email protected]][/tmp]$ sort msn.txt | uniq -w 3 aaa bbb bbb ccc ccc ddd
option:-s,跳过每行的前几个字符
[[email protected]][/tmp]$ sort msn.txt | uniq -s 3 aaa bbb aaa ccc bbb eee bbb sss ccc ddd
时间: 2024-11-07 00:10:41