A question concerning diff

Bob Peirce rbp at investor.UUCP
Mon Sep 8 05:30:46 AEST 1986


> > Is there a program, command, anything, that will take two files
> > {
> > 	1. An old text file
> > 	2. A "diff" format file
> > }
> > and make the changes listed in #2 on #1 and create file #3, the new text file?
> 
> The Sys III manual for diff(1) claims that diff -e file1 file2 will
> produce "a script of a, c and d commands for the editor ed, which will
> recreate file2 from file1."
> 
> I haven't tried it, but I assume something like the following might work.
> 
> 	ed file1 < diffs > file2
> 
> 	 	    Bob Peirce, Pittsburgh, PA

Bad assumption.  The manual also gives the solution.

	(cat diffs; echo '1,$p') | ed - file1 > file2
-- 

	 	    Bob Peirce, Pittsburgh, PA
	    uucp: ...!{allegra, bellcore, cadre, idis}
	  	     !pitt!darth!investor!rbp
			    412-471-5320

	    NOTE:  Mail must be < 30K  bytes/message



More information about the Comp.unix mailing list