I've made three text files: 0nl.txt
, 1nl.txt
and 2nl.txt
.
They both have the same content:
test
hello
The only difference between them is how many newlines they have after the final 'o', with 0, 1 and 2 respectively.
I can compare between the files using FC
:
C:\Users\NeatN\Desktop\fctest>fc 0nl.txt 1nl.txt
Comparing files 0nl.txt and 1NL.TXT
FC: no differences encountered
C:\Users\NeatN\Desktop\fctest>fc 0nl.txt 2nl.txt
Comparing files 0nl.txt and 2NL.TXT
***** 0nl.txt
***** 2NL.TXT
*****
C:\Users\NeatN\Desktop\fctest>fc 1nl.txt 2nl.txt
Comparing files 1nl.txt and 2NL.TXT
***** 1nl.txt
***** 2NL.TXT
*****
COMP
, on the other hand, detects that they have different sizes but doesn't show the differences between them:
C:\Users\NeatN\Desktop\fctest>comp 0nl.txt 1nl.txt /M
Comparing 0nl.txt and 1nl.txt...
Files are different sizes.
C:\Users\NeatN\Desktop\fctest>comp 0nl.txt 2nl.txt /M
Comparing 0nl.txt and 2nl.txt...
Files are different sizes.
C:\Users\NeatN\Desktop\fctest>comp 1nl.txt 2nl.txt /M
Comparing 1nl.txt and 2nl.txt...
Files are different sizes.
How do I detect the missing newline in 0nl.txt
compared to 1nl.txt
, and show it to the user?