Word Document to Text


This was a little chunk of code that I pulled together so that I could quickly view the textual contents of a Word Document. This can be used as a command line tool and does the trick fairly well, in my opinion. Of course, you will lose a lot of contextual information, so take it with a grain of salt. The code is provided below:

#!/usr/bin/perl  use Text::Wrap;  $Text::Wrap::columns = 80; my $file = join( '', <> );  $file =~ s/<[^>]*>//g; $file =~ s/\r//g; $file =~ s/[\t ]+/ /g; $file =~ s/\ //g;  print wrap( '', '', $file );

Posted: December 2nd, 2003 ·



Comments are closed.
Comments are automatically turned off two weeks after the original post. If you have a question concerning the content of this post, please feel free to contact me.


JavaScript Books

Secrets of the JavaScript Ninja

JavaScript Secrets

Secret techniques of top JavaScript programmers.

Pro JavaScript Techniques

Pro JavaScript

The best techniques for professional JavaScript. Published by Apress.

Micro Updates

John Resig Twitter Updates

@jeresig

Infrequent, short, updates and links.

JavaScript Jobs



via Ad Packs

Ukiyo-e: Japanese Woodblock Prints