patching two files

I had two files that both contained lines that I needed. The final result I wanted was a file called LocalSettings.php that could get the “goodies” from the two other files. The “goodies” here are variable lines containing specific details for a certain Wiki installation.

So my first file was called: LocalSettings.php.original

The other: LocalSettings.php.upgraded

I wanted to get the new lines from LocalSettings.php.upgraded into the LocalSettings.php.original.

First:

diff -Naur LocalSettings.php.original LocalSettings.php.upgraded > mypatch.file
Finally:

patch -p0 LocalSettings.php.original < mypatch.file

Leave a Reply

Your email address will not be published. Required fields are marked *