I have some difficulties comparing two txt files with batch. I used the "findstr" function with many option matchings but none works (for example FINDSTR /I /V /B /G:file1.txt file2.txt). I have a first txt file as following:
File1.txt
Object 1
Argument 50
Object 2
Argument 10
Object 3
Argument 10
Object 4
Argument 10
The second file has the same beginning as the first one:
File2.txt
Object 1
Argument 50
Object 2
Argument 10
Object 3
Argument 10
Object 4
Argument 10
Object 5
Argument 10
Object 6
Argument 50
Object 7
Argument 10
Object 8
Argument 10
The purpose of this comparaison is to separate the parts which are repeated (on the same lines only) in the second file. The results have to be as following:
File1.txt (unchanged)
Object 1
Argument 50
Object 2
Argument 10
Object 3
Argument 10
Object 4
Argument 10
and
File2.txt
Object 5
Argument 10
Object 6
Argument 50
Object 7
Argument 10
Object 8
Argument 10
A For loop may perhaps be usefull... Thanks a lot for your precious help!
The code below keep lines from File2.txt from the first line that differ vs. File1.txt on: