UnRTF!

If you are a GNU/Linux user, and you have been working with a Mac user or Mac software, the chances are that you have received files in RTF format. This is because it’s the default format of the standard Mac ‘text’ editor: TextEdit. I have nothing against RTF as a format, it just annoys me when it is used for plain text documents that don’t have (or need) any formatting.

There are a number of ways to deal with RTF on your GNU/Linux system, you could open the document in a word processor such as OpenOffice writer, or AbiWord, or use the RTF editor Ted. However, if the document has no special formatting information in it or you don’t care about the formatting, you probably want to remove the RTF markup.

UnRTF

UnRTF an aptly-named GNU command-line application that will convert RTF files to a variety of useful output formats. These include HTML, plain text, text with VT100 codes, LaTeX, and PostScript. All but HTML are currently flagged as alpha, however for simple documents I have found them to be fine. To run UnRTF, you need to issue the following command from a shell prompt:

unrtf --text mydoc.rtf > mydoc.txt

This will convert the RTF file mydoc.rtf to plain text format. For complex documents one might wish to use HTML as a transitional format, and then make use of other tools. For example [htmldoc][5] could be used to convert to pdf:

unrtf mydoc.rtf |  htmldoc --webpage -f mydoc.pdf -

And maybe you could even use the wonderful [ImageMagick][6] convert utility to rasterize the data:

convert -density 196 mydoc.pdf mydoc.png

I’m not sure what the purpose of that would be, but I thought I’d throw it in for fun!

Related Entries

About

I work at Birmingham Conservatoire as senior researcher and software development manager for the Integra Project. I live with my wife and three beautiful children in Birmingham, UK.» More...

Tag Cloud

Projects

-->
Close