001、一般去重复
[root@PC1 test01]# ls a.txt [root@PC1 test01]# cat a.txt ## 测试文本 c d c a b b [root@PC1 test01]# cat a.txt | sort | uniq ## 去重复后也排序了 a b c d
002、去重复后保持原来的顺序
[root@PC1 test01]# ls a.txt [root@PC1 test01]# cat a.txt ## 测试文本 c d c a b b [root@PC1 test01]# awk '!ay[$0]++' a.txt ## 去重复后保持原来的顺序 c d a b
。
标签:输出,顺序,##,test01,PC1,重复,Linux,txt,root From: https://www.cnblogs.com/liujiaxin2018/p/18009329