如何加入两个文本文件,删除重复,在Windows [英] How to join two text files, removing duplicates, in Windows

查看:250
本文介绍了如何加入两个文本文件,删除重复,在Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文件1

A
B
C

文件2

B
C
D

文件1 +文件2 =

file1 + file2 =

A
B
C
D

是否有可能使用CMD.EXE办?

Is it possible to do using cmd.exe?

推荐答案

如果你能affort使用区分大小写的比较,如果你知道,没有线都超过511字节(127 XP),那么你可以使用下面的:

If you can affort to use a case insensitive comparison, and if you know that none of the lines are longer than 511 bytes (127 for XP), then you can use the following:

@echo off
copy file1.txt merge.txt >nul
findstr /lvxig:file1.txt file2.txt >>merge.txt
type merge.txt

有关的限制说明,请参阅什么是无证的功能和Windows FINDSTR命令的限制?

For an explanation of the restrictions, see What are the undocumented features and limitations of the Windows FINDSTR command?.

这篇关于如何加入两个文本文件,删除重复,在Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆