GUI Software To Compare Two Files, Get "Clean" Export of Differences?

3

1

Is there a way to do a "clean" export of the differences between files? Not a diff, or even a formatted report... just a clean .CSV/.XLS/etc export.

This is for people that are non-technical; we have a number of nontechnical people in our company that could really use something like this. They work with mailing lists and need a way to extract the changes between list revisions.

As a programmer I know there are a large number of diff tools out there: WinDiff, BeyondCompare, FileMerge, command-line diff, etc. But I haven't been able to find one that will just give a clean export of the differences. (It's possible I've just missed something in one of the well-known diff tools I listed)

Example...

FileA.csv

1000, Aaron
1001, Bob
1002, Chris
1004, Erin

FileB.csv

1000, Aaron
1001, Bob
1002, Chris
1003, Dolores
1004, Edward

We'd like to export just the changed rows to... "ChangesInFileB.csv"

1003, Dolores
1004, Edward

FWIW, the support guys at Beyond Compare say they don't offer that.
http://www.scootersoftware.com/vbulletin/showthread.php?p=32298#post32298

This question is superficially similar but doesn't address the "clean export" thing https://superuser.com/questions/294142/can-somebody-recommend-a-program-to-compare-differences-in-two-text-files-and-re

John Rose

Posted 2011-12-27T18:21:49.973

Reputation: 345

2For plain text files, most Unix systems have comm -1 -3. – user1686 – 2011-12-27T18:29:08.127

So you need a "diff viewer" and an "diff exporter" in one tool. Or would an "exporter only" be enough too? E.g. If you would have it running as scheduled task and the users see only the diff file. – Raffael – 2011-12-27T20:09:48.437

Answers

2

You could just use the standard diff tool with some scripting.

For the two examples files, plain diff will output:

4c4,6
< 1004, Erin
---
> 1003, Dolores
> 1004, Edward

The < means "line removed", the > "line added". Just filter for > to get all lines that are in the second file, but not in the first:

$ diff a.csv b.csv |grep '>'|cut -c 3-
1003, Dolores
1004, Edward

(the cut part filtes out the leading >). You could put that into a script.

Note: The above assumes you have diff, grep & cut installed. They're standard on Linux and Mac OS X (I believe); for Windows you'd need Cygwin or similiar.

sleske

Posted 2011-12-27T18:21:49.973

Reputation: 19 887