Tapatalk

How to compare two text files strictly line by line?

How to compare two text files strictly line by line?

711
Advanced UserAdvanced User
711

PostAug 15, 2018#1

I want to compare two text files in such a way that File A line X is compared with File B line X in a static way. Is this possible?

6,823625
Grand MasterGrand Master
6,823625

PostAug 16, 2018#2

So you want to compare for example FileA.txt containing

Code: Select all

first line
second line
another line
last line
with FileB.txt containing

Code: Select all

first line
second line
third line
another line
last line
and get displayed that just first and second line are equal and all others are different because of third line existing only in FileB.txt. Is that right?

I think such a strict line by line text comparison is not possible with UltraCompare. I don't know how. I even don't know how this could be done with %SystemRoot%\System32.exe\fc.exe or any other comparison tool as all take inserted lines into account as far as I know.

I can imagine use cases on which a strict line by line comparison would be useful like FileA.txt contains

Code: Select all

123
45
67
890
and FileB.txt contains

Code: Select all

123
67
45
890
In this case it could be useful to get indicated that line 2 of FileA.txt is different to line 2 of FileB.txt and line 3 of FileA.txt is different to line 3 of FileB.txt whereas line 1 and 4 are equal in both files. But I don't know any comparison application which supports a strict line by line comparison for such rare use cases.

711
Advanced UserAdvanced User
711

PostAug 16, 2018#3

Hi Mofi,

Thank you, that is exactly what I am asking. I am finding the current UltraCompare algorithm over complex and doing unexpected things. Thanks for your help and replies.