问题
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
.
For example:
content.txt
abc
1234
hello
qwerty
remove.txt
abc
hello
def
result.txt
1234
qwerty
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.
回答1:
findstr /L /v /X /g:remove.txt content.txt>result.txt
/X means "match lines exactly"
?L means "literally - not regex"
/v means "not -matching"
/g:filename is filename to use as string-(exclusion)-source
/I would make case-insensitive.
来源:https://stackoverflow.com/questions/35746578/how-do-i-remove-all-the-lines-in-a-text-file-that-are-present-in-another-text-fi