Comparing configuration (i.e. ini, preferences, config, etc.) files is not as simple as comparing say C source file. Typically in a config file the order doesn't matter so
Is the same as
Hence all the usual Diff tools mistakenly say files are different when functionally they are the same. Comparing something like the /etc directory on two Linux machines thus involves a lot of hand checking of functionally identical files.
One solution to this is to sort the lines in the files first. The different files listed by a Diff program are then only those with real difference (assuming you turn off whitespace difference). This can be done very simply with KDiff3 which has the option to include a file preprocessor before the compare. This is found in KDiff3 in settings, diff tab. So by adding a file preprocessor such as for example:
perl -e 'print sort <>'
We can sort the file lines before the compare. On linux and windows this can be even simpler as they have native sort commands which work too. So all that needs adding in this case to the preprocessor setting is just "sort". Click the image above to see a screenshot of the settings dialogue.
- Lines are reordered so editing in a separated editor is a better idea than merging in KDiff3.
- Single settings that span multiple lines and multiple settings on a single line may show as different when functionally the same