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文档中不能包含空行,否则无法比较差异。

原文地址:https://www.cnblogs.com/chenjiahe/p/5733561.html