文件 1
A
B
C
文件 2
B
C
D
文件 1 + 文件 2 =
A
B
C
D
可以使用 cmd.exe 吗?
最佳答案
如果您可以努力使用不区分大小写的比较,并且您知道没有任何行的长度超过 511 个字节(XP 为 127 个字节),那么您可以使用以下内容:
@echo off
copy file1.txt merge.txt >nul
findstr /lvxig:file1.txt file2.txt >>merge.txt
type merge.txt
有关限制的说明,请参阅 What are the undocumented features and limitations of the Windows FINDSTR command? .
关于batch-file - 如何在 Windows 中加入两个文本文件,删除重复项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19816914/