Linux中按照指定列去重复

 

001、

[root@localhost test2]# ls
a.txt
[root@localhost test2]# cat a.txt        ## 测试数据
a       7
a       10
a       9
a       2
b       5
b       12
c       4
c       6
c       3
c       11
d       8
d       1
[root@localhost test2]# awk '!ay1[$1]++' a.txt      ## 按照第一列进行去重复
a       7
b       5
c       4
d       8

 

image

 。

 

posted @ 2026-08-27 19:51  小鲨鱼2018  阅读(14)  评论(0)    收藏  举报