help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: diff 20 files that are mostly equal


From: Ralf Wildenhues
Subject: Re: diff 20 files that are mostly equal
Date: Tue, 14 Apr 2009 19:27:14 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello,

* Bob Proulx wrote on Tue, Apr 14, 2009 at 06:26:02PM CEST:
> avilella wrote:
> > I would like to compare ~20 files that are mostly the same, but some
> > of them have 2-3 different lines in a couple of places. I can do a
> > diff for every pair, but I bould like to have one representation for
> > all files that is a consensus file then with extra tagged lines for
> > the differences. Is there any tool that does that? What would people
> > recommend?
> 
> I don't know of any tool that does that directly.

git can do 95% of what you need: its --find-copies-harder (aka -C -C)
logic in the "git log" code finds files with similarities and shows them
as such.

For example:

Create a new repo, put the files in separate commits, use "git log -C
-C" to tell you all kinds of similarities.

mkdir foo
cd foo
git init
for file in 1 2 3 20; do
  echo "wow
this
file
sure
looks
similar
to some
other file-$file" > file-$file
  git add file-$file
  git commit -m "file-$file"
done
git log -p -C -C

The only bit that is missing, if I understand your description
correctly, is to find a suitable consensus file.  You could try
this a few times with different initial files, or choose one that
you know is a good one.

Hope that helps.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]