grep replacement

Guy Harris guy at gorodish.Sun.COM
Fri Jun 17 03:45:25 AEST 1988


> In any context where I would trust "patch", I would also trust "ed" using
> the output of "diff -e", which is generally much less output.

In many contexts where I would trust "patch" with a context "diff", I would
*NOT* trust "ed" with a "diff -e" any further than I could throw it.

"diff -e" scripts contain line numbers that *must* match the lines in the file
being patched, at least if you're using "ed" - "patch" may be able to figure
out the right line numbers if you're not patching the exact same version of the
source, although I would not be surprised if it didn't, since "diff -e" scripts
don't have the context that makes this easier.

"diff -c" scripts contain the aforementioned context, so that they can be used
to apply patches to source that is *not* identical to the source from which the
"diff"s were made.  This is quite important in many cases.  (I use "diff -c"
and "patch" to merge different streams of changes to a source file, for
example.)

> I recently generated a "diff -c -b" comparison between SVR2 sh
> sources and the BRL version of sh.  The output was larger than
> the concatenation of all the sources.  It was useful for the
> intended purpose (browsing), but would be ludicrous for "patch"ing.

Yes, you can construct examples where "diff -c" output is too big to be
practical.  However, the vast majority of the "diff -c" patches I've seen
distributed are not that big; the context is a big win.



More information about the Comp.unix.wizards mailing list