LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apply diff to a file (https://www.linuxquestions.org/questions/linux-newbie-8/apply-diff-to-a-file-422559/)

powah 03-07-2006 02:25 PM

Apply diff to a file
 
After I do a diff between two files, how to apply the result to a file so that it is updated by the result?

e.g. diff filev1 filev2 > result
I want to use the result to modify a file (filev3) so that it contains the latest difference?

macemoneta 03-07-2006 03:00 PM

After creating the patch with, for example "diff -u" you apply it with the "patch" command. For example:

diff -u filev1 filev2 > result

To then turn file1 into file2, use:

patch < result


All times are GMT -5. The time now is 09:24 PM.