batch-file - 如何在 Windows 中加入两个文本文件,删除重复项

标签 batch-file

文件 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/

相关文章:

java - 在java中使用args执行批处理文件

Windows CMD 解释别名后的代码

google-chrome - 批处理文件动态查找chrome安装路径

windows - 如何在 Windows 7 中使用批处理脚本获取本地连接名称

batch-file - 用于运行批处理文件的 GUI

batch-file - 批处理 : How to store command output with spaces in variable?

batch-file - 使用 Hudson 远程运行批处理文件

batch-file - 批量替换为特殊字符不起作用

javascript - 无法使用 .bat 文件打开 Photoshop 的脚本

windows - 计算批处理文件中的已用磁盘空间