Compare the world
26 07 2008I quite often have to compare files that were originally edited on Linux or a Mac and then edited in Windows. If you subsequently run this through the 'diff' command line tool it will think every line is different because many Windows editors change the line endings from the Unix native LF (\n) to Dos/Windows native CRLF (\r\n).
There is however a solution to this problem, if you use diff in the following way it will stop these problems from happening:
diff --strip-trailing-cr -ubB
--strip-trailing-cr - Ignores the difference between Unix and Windows line endings
-u - Unified diff format (In my opinion the most readable and pretty much standard now)
-b - Ignore space change, ignores the difference in whitespace
-B - Ignore blank lines, if line spacing in certain areas has been changed this won't be a factor in the diff
Categories : Linux
Trackbacks : No Trackbacks »



