Dies ist eine alte Version des Dokuments!
When upgrading e.g. web based software or the Linux OS you usually have customized the config files to your personal need. Now the config files of the new software version also differ from the original version. What you want is an easy way to get your own modifications into the new config files.
The directory old/
contains the files of the old version of the software (with personal costumizations) whereas new/
is the brandnew pristine version. The following commands merge the personal modifications of the exemplary file conf
from old/
into new/
:
mv new/conf new/conf.org diff3 -m new/conf.org .old/conf.org old/conf > new/conf
Note that you need old/conf.org
, which is the original file of old version of the software. Eighter you have created that file by copying before you made any modifications to conf
or you can get it again by downloading the old version of the software.
An alternateve approach is by using the diff/patch commands:
cd old diff -u conf.org conf > conf.diff cd ../new patch < ../old/conf.diff
A manual check after the patch is applied is advisable, for there are sitiation where do not produce the expected results:
This is an example where diff/patch doesn't work as expected (but diff3 works):
old/conf.org: old/conf: new/conf.org desired: result: [mitwitz] [mitwitz] [coburg] [coburg] [coburg] Otto=5 Otto=5 Otto=5 Otto=5 Otto=5 Guenter=6 Guenter=6 Guenter=6 Guenter=6 Guenter=6 Harry=7 Harry=7 Harry=7 Harry=7 Harry=7 Franz=8 Franz=-999 Franz=8 Franz=8 Franz=-999 Helga=9 Helga=9 Helga=9 Helga=9 Helga=9 Egon=10 Egon=10 Egon=10 Egon=10 Egon=10 Anton=11 Anton=11 Anton=11 Anton=11 Anton=11 [mitwitz] [mitwitz] [mitwitz] Otto=5 Otto=5 Otto=5 Guenter=6 Guenter=6 Guenter=6 Harry=7 Harry=7 Harry=7 Franz=8 Franz=-999 Franz=8 Helga=9 Helga=9 Helga=9 Egon=10 Egon=10 Egon=10 Anton=11 Anton=11 Anton=11
This is an example where neither of the tools work as expected:
old/conf.org: old/conf: new/conf.org desired: result: [mitwitz] [mitwitz] [coburg] [coburg] [coburg] Otto=5 Otto=5 Otto=5 Otto=5 Otto=5 Guenter=6 Guenter=6 Guenter=6 Guenter=6 Guenter=6 Harry=7 Harry=7 Harry=7 Harry=7 Harry=7 Franz=8 Franz=-999 Franz=8 Franz=8 Franz=-999 Helga=9 Helga=9 Helga=9 Helga=9 Helga=9 Egon=10 Egon=10 Egon=10 Egon=10 Egon=10 Anton=11 Anton=11 Anton=11 Anton=11 Anton=11 [mitwitz] [mitwitz] [mitwitz] Otto=5 Otto=5 Otto=5 Guenter=6 Guenter=6 Guenter=6 Harry=7 Harry=7 Harry=7 Franz=8 Franz=-999 Franz=8 Helga=9 Helga=9 Helga=9