18

I have two ODT documents, they have very close contents, I want to compare them to see how similar they are.

The best would be to have a similarity percentage, if not possible, an alternative would be at least to have some sort of diff.

I am running Ubuntu Lucid.


Solution:

I used odt2txt to convert the files to text, then used wdiff -i --statistics one.txt two.txt to have a diff along with statistics which gave me the percentage of common words (similarity).

James Mertz
  • 26,224
  • 41
  • 111
  • 163
Weboide
  • 336
  • 1
  • 2
  • 10
  • possible duplicate of [How do a binary diff on two identically sized files under linux?](http://superuser.com/questions/135911/how-do-a-binary-diff-on-two-identically-sized-files-under-linux) – James Mertz Jun 22 '12 at 21:43

4 Answers4

25

Did you try the built-in compare functionality? Edit -> Track Changes -> Compare Document....

If you just want a textual diff, your best bet is probably to convert both documents to plain text, then run a regular diff on them. You will have to figure out how to normalize linebreaks though, otherwise the diff will not be very useful.

sleske
  • 22,652
  • 10
  • 69
  • 93
  • 1
    Great function in LibreOffice, I had never heard about it! Very useful but no stats are given. – stragu May 24 '13 at 03:07
  • Excellent! I never would have thought to look in an *Edit* menu to compare documents. I looked in *File*, *Tools*, and *Window*, the last being uSoft's Word location. – wallyk Mar 24 '14 at 18:26
  • 6
    In the latest version it seems to be Edit -> Track Changes -> Compare Document... – FableBlaze Aug 12 '16 at 10:21
  • 1
    @FableBlaze: Thanks, edited (though it took me a while...). – sleske Jan 12 '21 at 08:36
8

I haven't tried them myself but this pair of tools - odt2txt and oodiff - looks promising.

Torello
  • 103
  • 3
JRobert
  • 6,744
  • 24
  • 28
  • 1
    I used odt2txt to convert them to text, and then used wdiff which gives a diff by word. – Weboide Jul 13 '10 at 10:36
  • Thanks. This is great for use in version control systems like git or mercurial. See integration / automation techniques at [OpenDocument, diff, and revision-control](http://www-verimag.imag.fr/~moy/opendocument/) – nealmcb Jan 26 '15 at 19:23
1

If you don't care about text formatting, you may as well copy the contents to plaintext files and use good old diff.

ps: Are you a teacher looking for possible cheaters ? :p

tamtakos
  • 171
  • 1
1

The way I do this is to produce .pdf files with libreoffice and then use diffpdf to compare the two pdf files. This shows the differences highlighted in parallel windows