ASCII-fying RTF from the command line

Suppose I have an RTF file, with things like colors and superscripts/subscripts in it, and I want to be able to strip out all of the extra formatting and turn it into just a plain text file. I could do this, for example, by selecting everything in the RTF file, copying it to the clipboard, and pasting it into a text editor. But suppose I want to be able to do this in an automated way, from the command line. Is there any simple, standard tool that will do this?

To be a little more clear on my requirements, I do not want to leave any trace of the formatting: Text that was formerly superscripted should not be indicated by a ^, or anything like that. And it is essential that it does preserve all whitespace.

If it matters, I’m on Mac OSX, 10.4 or 10.6, and the RTF files would be of the sort generated by TextEdit.

In Terminal, type ‘man textutil’

UnRTF does everything you want and more. Look to your distro’s package management system to install it.

Thanks Squink, it looks like that does exactly what I want.