linux环境下根据文件的某一列进行去重

momo@ubuntu:~/user/txt$ cat test.txt
1 chen nihao
2 chen hello
3 li nimenhao
4 he dajiahao
5 li nimenhao
momo@ubuntu:~/user/txt$ sort -k2,2 -u test.txt
1 chen nihao
4 he dajiahao
3 li nimenhao

momo@ubuntu:~/user/txt$ cat test1.txt
1 chen nihao
2 chen hello
3 li nimenhao
4 he dajiahao
5 li nimenhao
6 she nimenhao
momo@ubuntu:~/user/txt$ sort -k3,3 -u test1.txt
4 he dajiahao
2 chen hello
1 chen nihao
3 li nimenhao

上一篇:unity如何显示血条(不使用NGUI)


下一篇:类文件的结构、JVM 的类加载过程、类加载机制、类加载器、双亲委派模型