[kwlug-disc] Converting a document

john at netdirect.ca john at netdirect.ca
Tue May 19 08:31:46 EDT 2009


kwlug-disc-bounces at kwlug.org wrote on 05/18/2009 09:23:32 PM:
> Ya, probably.  Sadly, I never spent much time learning script writing,
> so I was hoping to avoid that.  I was hoping that someone might know of
> an existing script to do it, since the author implies that a word
> processor could do it.

Script is being generous. Sed can do it like this:

sed -i 's-L\(.\): \[\([^]]*\)\] :L.-<h\1>\2</h\1>-' /tmp/document.txt

Although the regular expression looks complicated it only represents a few 
operators.

But it looks like there are lots of other fixes needed. There are foot 
notes, dots signifying empty lines, rows of asterisks, lists, etc.

Unless you have lots of other documents that use the same formatting you 
may be better off to run a few replaces, like the sed command above, and 
manually edit the rest.


John Van Ostrand
Net Direct Inc.
 
CTO, co-CEO
564 Weber St. N. Unit 12
map
 
Waterloo, ON N2L 5C6
 
john at netdirect.ca
Ph: 866-883-1172
ext.5102
Linux Solutions / IBM Hardware
Fx: 519-883-8533
 





More information about the kwlug-disc_kwlug.org mailing list