Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!ut-sally!pyramid!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.unix Subject: Re: A question concerning diff Message-ID: <6882@sun.uucp> Date: Thu, 4-Sep-86 11:47:39 EDT Article-I.D.: sun.6882 Posted: Thu Sep 4 11:47:39 1986 Date-Received: Fri, 5-Sep-86 03:19:25 EDT References: <194@wolf.UUCP> <764@ptsfb.UUCP> Organization: Sun Microsystems, Inc. Lines: 29 > >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@sun.com (or guy@sun.arpa)