grep -vFf 比较2个文件差异

grep -vFf 1.txt 2.txt   打印出2.txt中与1.txt有差异的数据。

#cat 1.txt 
192.168.0.1
192.168.0.2
192.168.0.3
#cat 2.txt 
chenjiahe
192.168.0.1
192.168.0.2
192.168.0.5
#grep -vFf 1.txt 2.txt
chenjiahe
192.168.0.5

注意:1.txt 与2.txt文档中不能包含空行,否则无法比较差异。

posted @ 2016-08-03 16:56  snale1989  阅读(1781)  评论(0编辑  收藏  举报