Roman N
Roman N

Reputation: 5110

Tool for plain text comparison by word

I need simple tool or library for text comparison. I could use diff by it isn't appropriate because it compare text by lines. Is there tool which could compare plain text by word? At example I have 2 file with long line.

File1
aaa bbb .... cccc

File2
aaa eee .... cccc

When I use diff it show that there 1 different line.

Diff
aaa eee .... cccc
---    
aaa bbb .... cccc

I need something like that:

Diff
aaa -[bbb] +[eee] ... cccc 

Upvotes: 1

Views: 243

Answers (1)

armel
armel

Reputation: 2580

There is a tool called wdiff by the GNU project (called after word diff). This is a front-end to diff which cuts lines on blanks and then compute the word oriented diff from the internal word-lines oriented output.

It should provide results similar to what you need.

Upvotes: 2

Related Questions