In the process of comparing files between 2 versions of an application i've noticed that a number of files seem to have gained additional blank lines throughout the file. These files were never uploaded by FTP, purely copied from one location to another using cp
and its not even every single file in the directory, just seemingly random ones. When i do a diff between the files in a side by side format ignoring spaces, newlines etc i just see a bunch of caveats showing the difference as the new line, so this:
diff --suppress-common-lines -Bbwy /home/site1/public_html/file.php /home/site2/public_html/file.php
outputs something like this:
>
>
>
>
>
>
I guess this is 2 questions then:
why would the file have gained these extra new lines, is this a line ending issue somehow and how can i check?
Is it possible to do a diff that will completely ignore these lines and recognise the files as identical which essentially they seem to be?
FYI this is on a CentOS server.
It seems that this was caused by another Developer having an auto-sync setting with his copy of Dreamweaver.
Part 1: Could be several things, like pboin mentioned, if you open it in an editor, it can add a newline or convert line endings, or I commented, if the source or target file system is an MSDOS/FAT partition.
Part 2: try --strip-trailing-cr