comm
Last updated
[root@localhost text]# cat aaa.txt
aaa
bbb
ccc
ddd
eee
111
222[root@localhost text]# cat bbb.txt
bbb
ccc
aaa
hhh
ttt
jjjcomm: 文件2 没有被正确排序
comm: 文件1 没有被正确排序[root@localhost text]# comm --nocheck-order aaa.txt bbb.txt
aaa
bbb
ccc
aaa
ddd
eee
111
222
hhh
ttt
jjj
第一列 第二列 第三列[root@localhost ~]# sort aaa.txt > aaa1.txt
[root@localhost ~]# sort bbb.txt > bbb1.txt[root@localhost ~]# comm aaa1.txt bbb1.txt
111
222
aaa
bbb
ccc
ddd
eee
hhh
jjj
ttt[root@localhost text]# comm aaa.txt bbb.txt -1 -2
bbb
ccc[root@localhost text]# comm aaa.txt bbb.txt -3 | sed 's/^\t//'
aaa
aaa
ddd
eee
111
222
hhh
ttt
jjj[root@localhost text]# comm aaa.txt bbb.txt -2 -3
aaa
ddd
eee
111
222[root@localhost text]# comm aaa.txt bbb.txt -1 -3
aaa
hhh
ttt
jjj