Solved Compare text files

November 10, 2011 at 07:09:54
Specs: Windows XP
I'm try to find a way that I can compare to two text files that are list and make a new file with the differences. I was try to use a batch file, but I'm not sure if that is the best to write it in.

Here is an examples of the files:

Master.txt
12345678
11111111
22222222
33333333
01010101

List.txt
12345678
11111111
87654321
22222222
33333333
01010101

so what I would like to do is have it look though these two files and if the "List" file has a set of numbers that the "master" file dose not I would like to put it in a new text file.

any help would be much appreciated


See More: Compare text files

Report •

#1
November 10, 2011 at 08:23:25
✔ Best Answer
@echo off
for /F %%j in (List.txt) do type Master.txt | find "%%j" > nul || echo.%%j>> Result.txt

The above script does the job and is straightforward, BUT higly inefficent too since it performs m x n read to the Master file where m is the number of rows of List.txt and n the lines of Master.txt. However if files' size is not too huge , this may be the solution.


Report •
Related Solutions


Ask Question