Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-07-2006, 01:25 PM   #1
Registered: Mar 2005
Distribution: FC, Gentoo
Posts: 276

Rep: Reputation: 30
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?
Old 03-07-2006, 02:00 PM   #2
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
chcon: can't apply partial context to unlabeled file... DevNRG Linux - General 7 10-12-2005 04:01 PM
.diff files. How do I apply them? tardigrade Linux - Software 1 08-14-2005 09:05 PM
What is *.diff file? carboncopy Slackware 1 05-19-2004 10:26 AM
DIFF (or other file comparison) ciscokid1967 Linux - General 1 12-11-2003 02:13 PM
I have a patch (diff file). What now? Gurduloo Linux - Newbie 2 05-27-2003 02:20 PM > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration