# sort FILE1 -o FILE1
# sort FILE2 -o FILE2
# cat FILE1
Chinese
city
conservation
expect
quota
water
will
# cat FILE2
businesses
city
expect
given
industrial
said
then
现在直接用 comm 来比较一下上面的文件:
root@bt:~/shell# comm FILE1 FILE2
businesses
Chinese
city
conservation
expect
given
industrial
quota
said
then
water
will
# comm FILE1 FILE2 -1 -2
city
expect[/qutoe]
如果只想列出第 1 个文件中独有的内容,那么就要删除掉第 2 列和第 3 列:
[quote]# comm FILE1 FILE2 -2 -3
Chinese
conservation
quota
water
will