I am looking for a STDIN/STDOUT supported program that can return the difference (preferably in RTF format) between two RTF files or strings, similar to how GitHub tracks changes between two text-files. I'd rather not have to build something like this from scratch.

Change-tracking in GitHub

  • RTF only supports fairly basic formatting information. It may be that the diff report is too complex to be saved as RTF.
    – Eric S
    Mar 22, 2020 at 13:11
  • @EricS RTF supports everything that MS Word supports, so definitely it can represent all web pages. It's just extremely space inefficient and almost impossible to read the source later
    – phuclv
    Jul 16, 2021 at 1:45

3 Answers 3

diff <(unoconv --stdout -f pdf file1.rtf | pdftotext -layout - -) \
     <(unoconv --stdout -f pdf file2.rtf | pdftotext -layout - -)

The unoconv utility converts the RTF files to PDF. The pdftotext utility extracts the text from the PDF streams. The diff command compares the two streams and outputs the results to standard output.

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jan 5 at 21:48
  • 1
    I disagree with the Community Bot that your answer is unclear! :) Your answer is very clear to me. The OP did prefer the output to be in RTF output, but they mentioned that as a preference, and not as a hard requirement. Your answer is missing links to unoconv and pdf2text, so I'll add them for you (if you have preferred links, feel free to edit). As a new community member, welcome, and an upvote for your first useful answer! Jan 6 at 2:26

You can use WinMerge.

WinMerge is a free software tool for data comparison and merging of text-like files. It is useful for determining what has changed between versions, and then merging changes between versions.

Encyclopedia information about WinMerge - Wikipedia

Command line - WinMerge 2.12 Manual Page at winmerge.org

  • This does not solve my problem. The application does not allow me to export the difference (the /o argument does not work), it doesn't show me the specific difference in RTF-format (only in plain text, which is unreadable for the average user) and even with the xdocdiff-plugin (which converts the RTF to plain text) it does not show me the specific changes when I e.g. change the font color.
    – Im2be
    Jun 17, 2019 at 14:21

If you want to get the result back as RTF then the comparison needs to understand RTF. One way would be simply to read the RTF into an application that understands RTF, such as Word or OpenOffice/LibreOffice then do the comparison in that application and export the result as RTF.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.