I've been for long using git's (colored) --word-diff
which I find awesome. I found myself today in a situation where I had two strings I needed to compare word by word and craving for something just like git's diff.
I am aware of wdiff
+ colordiff
, but its results certainly aren't stellar:
me@me:~$ wdiff <(echo -e "abc\ndef") <(echo -e "dbcx\ndef") | colordiff
[-abc-]{+dbcx+}
def
Is there any better option around? I don't particularly like those [-
, -]
and {+
, +}
.
Best Answer
You can use
git
's own diff-highlight. It can highlight word differences in unifieddiff
output, and it can also cope with ANSI colors on input. So you can do something like this: