用纯批应当也可,文本文件及批处理均保存为ANSI编码:- @echo off
- setlocal enabledelayedexpansion
- set n=0
- for %%I in (1.txt 2.txt 3.txt) do (
- for /f "tokens=2 delims=:" %%i in ('find /v /c "" %%I') do (
- if %%i gtr !n! set n=%%i
- )
- )
-
- (for /l %%i in (1,1,%n%) do (
- set /p str1=
- if !str1! neq !str2! (
- echo,!str1!
- ) else (
- echo,
- )
- set str2=!str1!
- ))<1.txt>1.log
-
- (for /f "delims=" %%i in (1.log) do (
- set /p str1=
- if !str1! neq !str2! (
- echo,%%i !str1!
- ) else (
- echo,%%i
- )
- set str2=!str1!
- ))<2.txt>2.log
-
- (for /f "delims=" %%i in (2.log) do (
- set /p str1=
- if !str1! neq !str2! (
- echo,%%i !str1!
- ) else (
- echo,%%i
- )
- set str2=!str1!
- ))<3.txt>1.log
- del 2.log
- pause
复制代码 代码未经测试。 |