views:

229

answers:

2

This StackOverflow answer has an image of KDiff3 highlighting intra-line differences. Does someone know of a tool which can show the same (ex, via color) on the command line?

Another way to think of this is wanting to diff each difference in a patch file.

+1  A: 

I don't know if this is sufficiently command line for your purpose, but vimdiff can do this (even does colour). See for example this screenshot or the image in this related question.

ire_and_curses
+1  A: 

You might be able to use colordiff for this.

In their man page:

Any options passed to colordiff are passed through to diff except for the colordiff-specific option 'difftype', e.g.

colordiff --difftype=debdiff file1 file2

Valid values for 'difftype' are: diff, diffc, diffu, diffy, wdiff, debdiff; these correspond to plain diffs, context diffs, unified diffs, side-by-side diffs, wdiff output and debdiff output respectively. Use these overrides when colordiff is not able to determine the diff-type automatically.

I haven't tested it, but the side-by-side output (as produced by diff -y file1 file2) might give you the equivalent of in-line differences.

Mark Rushakoff
Nope, doesn't seem to work
Brian Harris
You can also pipe diff output into colordiff, but I confirm that it doesn't work
Sam Brightman