Search code examples
mergediffradix

How to get modified file from base file and diff file?


Consider the following example :

$ls
base.txt base-modified.txt
$diff base.txt base-modified.txt > diff.txt
$rm base-modified.txt
$

I want the base-modified.txt from base.txt and diff.txt... Can anyone suggest a way ?


Solution

  • You can use patch.

    cp base.txt base-modified.txt
    patch base-modified.txt diff.txt