I have two text files I wish to make sure are the same, the problem is that file1 (SELECT_20150210.txt
) is generated on a windows platform, and file2 (sel.txt
) is generated on a mac, so the two files have different line terminating characters even though they look the same:
The first line:
Eriks-MacBook-Air:hftdump erik$ head -n 1 sel.txt
SystemState 0x04 25 03:03:48.800 O
Eriks-MacBook-Air:hftdump erik$ head -n 1 SELECT_20150210.txt
SystemState 0x04 25 03:03:48.800 O
cmp
says they are different:
Eriks-MacBook-Air:hftdump erik$ cmp sel.txt SELECT_20150210.txt
sel.txt SELECT_20150210.txt differ: char 35, line 1
But it's only the terminating characters that differ:
Eriks-MacBook-Air:hftdump erik$ head -n 1 SELECT_20150210.txt | hexdump -C
00000000 53 79 73 74 65 6d 53 74 61 74 65 09 30 78 30 34 |SystemState.0x04|
00000010 09 32 35 09 30 33 3a 30 33 3a 34 38 2e 38 30 30 |.25.03:03:48.800|
00000020 09 4f 0d 0a |.O..|
00000024
Eriks-MacBook-Air:hftdump erik$ head -n 1 sel.txt | hexdump -C
00000000 53 79 73 74 65 6d 53 74 61 74 65 09 30 78 30 34 |SystemState.0x04|
00000010 09 32 35 09 30 33 3a 30 33 3a 34 38 2e 38 30 30 |.25.03:03:48.800|
00000020 09 4f 0a |.O.|
00000023
So is there a way to cmp
or diff
these two file and telling cmp
to ignore the different line terminating character? Thank you