A question concerning diff

Guy Harris guy at sun.uucp
Fri Sep 5 01:47:39 AEST 1986


> >Is there a program, command, anything, that will take two files
> >and make the changes listed in #2 on #1 and create file #3, the new text
> >file?
> 
> Absolutely. See the -e and -f options of diff(1).

No, that takes two files and produce an "ed" script that will make the
changes mentioned.  It sounds like he may have wanted something that takes
an *existing* "diff" listing, *not* necessarily produced with "diff -e", and
make the changes.

There is, in fact, such a program.  It's called "patch", was written by
Larry Wall, and has been posted either to "net.sources" or "mod.sources" on
various occasions.  It is also supplied as part of the "user contributed
software" with 4.3BSD (although I think the version posted most recently
fixes some bugs that ar in the version that comes with 4.3BSD); the "Bug
Fixes and Changes in 4.3BSD" document says "If you only look at one new
program, this is the one!", and they're right.

It is not only useful for applying fixes supplied in the form of "diff" or
context "diff" listings, it is also useful for applying fixes made to one
version of a program to other versions (e.g., if you fix a bug in Version 3
of something, it can be used for applying the fix to Version 2.2; just
"diff" the unfixed and fixed Version 3 source and then use "patch" on the
Version 2.2 file).
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.com (or guy at sun.arpa)



More information about the Comp.unix mailing list