Old.txt
包含
apple
orange
banana
And New.txt
包含
apple
orange
banana
grape
lemon
我可以访问添加到的新内容New.txt
using grep
命令。
grep -Fxvf Old.txt New.txt > difference.txt
Now, difference.txt
包含
grape
lemon
在Windows中,我尝试过
findstr /rvc:Old.txt New.txt > difference.txt
找到差异,但它附加了内容Old.txt
也。如何在 Windows 中编写等效命令?
您可以使用DOS
findstr具有以下标志:-
/v : Prints only lines that do not contain a match.
/g: file : Gets search strings from the specified file.
该命令类似于:-
C:\Users\dude\Desktop>findstr /v /g:Old.txt New.txt >difference.txt
现在使用以下命令检查文件输出type
命令;相当于cat
in Linux
, 我们看 :-
C:\Users\dude\Desktop>type difference.txt
grape
lemon
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)