Split RTF files
March 28, 2006 4:12 AM   Subscribe

What is the best way to split an RTF file?

I want to be able to insert a string of text at specified locations in an RTF file and then have the file automatically split at these locations, producing a number of smaller files with derived names. Is there any utility that will do this?
posted by megatherium to Computers & Internet (5 answers total)
 
I've never found any Unix utility or PHP extension that will parse RTF files in any way at all. It's ironic that there are several programs to handle DOC files, but nothing for RTF.
posted by waldo at 7:24 AM on March 28, 2006


I actually had to write a RTF file parser once (in, say, 1990) and it's not a pleasant format. People have gotten a lot better at designing file formats since then.
posted by GuyZero at 7:45 AM on March 28, 2006


Oops, I forgot my point. There's a lot of intra-file referencing to things like styles, so it's impossible to do a simple file split. It's like an HTML file - you'd have to replicate the header in both files in addition to splitting the body.
posted by GuyZero at 7:46 AM on March 28, 2006


If you have low-level VB skills and MS Office, you could write a Word macro to do it. Older versions of MS Office (pre-97) use a BASIC-like language that is dern easy to pick up.
posted by deadfather at 8:01 AM on March 28, 2006


There are tons of Perl modules which deal with RTF, see CPAN -- I don't know what they do in detail but there are all kinds of things there, parsers, readers, writers, so you should be able to cobble something together. Ask politely at perlmonks.org and you will probably get some useful help.
posted by AmbroseChapel at 11:53 AM on March 28, 2006


« Older Gravity and relativity.   |   konbini toy /modular doll's house filter Newer »
This thread is closed to new comments.