当前位置: 首页 > Linux

Linux命令学习:uniq命令

时间:2023-04-06 05:29:06 Linux

Linux命令学习:uniq命令uniq命令可以去除排序文件中的重复行,所以uniq经常和sort结合使用。也就是说,所有重复行必须相邻才能使uniq起作用。uniqsyntax[root@www~]#uniq[-icu]选项及参数:-i:忽略大小写字符的区别;-c:计数-u:只显示不重复的行testfile内容如下:cattestfilehelloworldfriendhelloworldhello直接删除不用的整理文件后会发现没有一行被删除。**#uniqtestfilehelloworldfriendhelloworldhello排序后的文件,默认去重#catwords|sort|uniqfriendhelloworld排序后删除重复行,在行首输出重复行次数#sorttestfile|uniq-c1friend3hello2world只显示重复行,并在行首显示该行重复的次数#sorttestfile|uniq-dc3hello2world只显示非重复行sorttestfile|uniq-ufriend参考:http://www.cnblogs.com/ggjuch...