[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Anything more powerful than diff's -I...?
From: |
Bill Rugolsky Jr. |
Subject: |
Re: Anything more powerful than diff's -I...? |
Date: |
Fri, 14 Sep 2007 17:25:14 -0400 |
User-agent: |
Mutt/1.4.2.2i |
On Fri, Sep 14, 2007 at 01:05:27PM -0700, Paul Eggert wrote:
> Paul Smith <address@hidden> writes:
>
> > I guess I could do something like remove all the const's from the file
> > then compare that, and if it was the same I would skip it and if it was
> > different I could run diff on the original files.
>
> I find this strategy useful in other circumstances too. Typically I
> don't bother to run diff on the original files; I just run it on their
> transformed versions. It'd be nice if "diff" supported this sort of
> thing better. (I don't know of other tools that do.)
Transform "don't care input patterns" into a unique whitespace pattern on
input [*], do an ignore-whitespace compare [diff -b or --ignore-all-space],
and transform it back on output.
[*] You can encode a list of patterns using a variable-length "binary"
(e.g., Huffman-like) representation via the little-used vertical tab
"\v" and form-feed "\f" patterns. Be sure to start it off with "\v",
since form-feed sometimes appears in source code for pagination.
I once had a hackish (sh+awk) word-oriented diff script that applied this
and other transformations, but I lost the script long ago (on QIC tape).
Something similar is easy to reproduce though, and there are word-oriented
diff utils available today.
Regards,
Bill Rugolsky