I searched through all the posts to find content about comparing the differences between two files and outputting the result, but I couldn't find the needed content at all. In desperation, I can only post.
The idea is like this: I want to compare the differences between two files 1.TXT and 2.TXT and output the result to 3.TXT
I have code for comparing differences, but it doesn't seem to work effectively; it can only compare one difference!
The code is as follows:
@echo off
:: Extract the differences between the two files to a certain file
:: code by jm 2006-9-9 CMD@XP
cd.>3.txt
for /f "tokens=1* delims=:" %%i in ('findstr /n. 1.txt') do (
for /f "tokens=1* delims=:" %%x in ('findstr /n. 2.txt') do (
if %%i equ %%x if not "%%j"=="%%y" (>>3.txt echo 1:%%j&>>3.txt echo 2:%%y&>>3.txt echo.)
)
)
I don't understand this code very well. Please help experts write a simple one. I remember that there was a master who wrote a simple one, but I can't find it! Please everyone. This problem has puzzled me for a long time..........
─────────────────── Moderation Record ────────────────────
Performer: lxmxn
Operation: Modify topic title
─────────────────── Moderation Record ────────────────────
[ Last edited by luckboy45 on 2007-5-30 at 06:56 PM ]
The idea is like this: I want to compare the differences between two files 1.TXT and 2.TXT and output the result to 3.TXT
I have code for comparing differences, but it doesn't seem to work effectively; it can only compare one difference!
The code is as follows:
@echo off
:: Extract the differences between the two files to a certain file
:: code by jm 2006-9-9 CMD@XP
cd.>3.txt
for /f "tokens=1* delims=:" %%i in ('findstr /n. 1.txt') do (
for /f "tokens=1* delims=:" %%x in ('findstr /n. 2.txt') do (
if %%i equ %%x if not "%%j"=="%%y" (>>3.txt echo 1:%%j&>>3.txt echo 2:%%y&>>3.txt echo.)
)
)
I don't understand this code very well. Please help experts write a simple one. I remember that there was a master who wrote a simple one, but I can't find it! Please everyone. This problem has puzzled me for a long time..........
─────────────────── Moderation Record ────────────────────
Performer: lxmxn
Operation: Modify topic title
─────────────────── Moderation Record ────────────────────
The problem has been completely solved. Special thanks to the enthusiastic friends of the DOS Union for their warm help!
[ Last edited by luckboy45 on 2007-5-30 at 06:56 PM ]


