11

Can anyone recommend software (preferably freeware) for batch converting rtf files to txt files on Unix?

1
  • 1
    What format do you want the txt files to be? Stripped of all formatting, or somewhat richer, e.g. Markdown, like this site supports?
    – Daniel Beck
    Feb 8, 2011 at 17:19

4 Answers 4

5

There are many different ones, here are the ones I've tested successfully (all open source and free):

  • unrtf
  • wv
  • unoconv
3
  • 1
    antiword doesn't work with rtf documents, as far as i can tell.
    – dino
    Jun 14, 2015 at 18:05
  • @dino: You are right, my mistake.
    – Thor
    Jun 15, 2015 at 0:03
  • Tried these, but also wanted link information, without using full latex or PDF, so I use this too: grep -ioP 'HYPERLINK "([^)]+)"' (xout) | cut -d' ' -f2 | tr -d '"'
    – Pysis
    Oct 11, 2022 at 15:50
4

You didn't mention what flavour of UNIX but I think there's a textutil on many.

http://www.unix.com/man-page/All/1/TEXTUTIL/

 -convert fmt  Convert the specified files to the indicated format and
       write each one back to the file system.

       fmt is one of:  txt, html, rtf, rtfd, doc, docx, wordml,
               odt, or webarchive
1
  • 2
    That's only available on OS X. Check the bottom of the man page.
    – Ross Light
    Dec 3, 2012 at 21:43
3

There is "unrtf", but while the Ubuntu package data claims that it can create text output, the GNU unrtf homepage does not mention that format. But perhaps you can try that.

1
  • 1
    Ubuntu is right. The man page says: --text selects plain ASCII text output.
    – Themroc
    Dec 9, 2016 at 23:54
2

A quick glance at an RTF file suggests that RTF markup is anything between {braces} and anything between a backslash and a space \markup. So maybe strings and a short sed/awk/perl script to delete markup would get you close to plain text.

Not the answer you're looking for? Browse other questions tagged .