[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to use patch



Hallo Link,

* Link Dupont <link@subpop.net> [2004-02-27 15:05]:
> > i am vijay and i would like to know how to use patch
> > the source code . i got through net as well as all the
> > manual  pages but i could not find myself in a state
> > that i can use a patch command.
> > I will be greatful to you ,
> 
> `man patch` or `info patch`?

You can use the diff command to get the differences between two files.
To patch a file you have to youse the Unified Diff format.
For that you have to youse diff with the -u option.
It looks like this:
--- file1 Sun Jan 25 16:22:30 2004
+++ file2 Sun Jan 26 17:32:39 2004
@@ -1,5 +1,11 @@
- foobarfoobar
- foobarfoobar
+ that is not a foo bar
+ fnord
[..]

if you use > to put the output in a file, for example foobar with:
diff -u file1 file2 > foobar
you can use the patch command to patch the file.
for example with:
patch -b -p0 < foobar

for more information read the manuals of diff and patch.
regards nico 

-- 
Nico Golde nico <at> ngolde <dot> de
public key available on:
http://www.ngolde.de/gpg.html
echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc

Attachment: pgp3gU4hchGlk.pgp
Description: PGP signature


Reply to: