问题描述
我有两个文件: content.txt
和 remove.txt
.我想运行 .cmd
脚本,该脚本将从 remove.txt
中的 content.txt
中删除所有行.结果应转到 result.txt
.
I have two files: content.txt
and remove.txt
. I would like to run .cmd
script that removes all lines from content.txt
that are in remove.txt
. The result should go to result.txt
.
例如:
content.txt
abc
1234
hello
qwerty
remove.txt
abc
hello
def
result.txt
1234
qwerty
这个问题是相同的,但是使用Perl:.我只能使用标准的Windows工具.
This question is the same but using Perl: Removing lines in one file that are present in another file. I can only use standard Windows tools.
推荐答案
findstr /L /v /X /g:remove.txt content.txt>result.txt
/X表示精确匹配线"
/X means "match lines exactly"
?L的意思是字面意义-不是正则表达式"
?L means "literally - not regex"
/v表示不匹配"
/g:文件名是用作字符串-(排除)-源的文件名
/g:filename is filename to use as string-(exclusion)-source
/我会区分大小写.
这篇关于如何删除Windows中另一个文本文件中存在的文本文件中的所有行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!