Thursday, July 27, 2006

Making diff work

This came up at work twice recently: sometimes diff fails badly. I tinkered with it for a while years ago, and found the answer: if the first lines in the two files fed to diff are not the same, diff says the files are completely different, even if the first line has the only change. So diff gets it right in all cases except a mis-match on the first lines. Keep that in mind if you think diff has gone crazy. (Try adding a blank line at the top.)

No comments:

Post a Comment