On Sun, 02 Dec 2007 11:49:56 -0500, Jim Hartley <[EMAIL PROTECTED]>
wrote:
>I have occasion to do this from time to time, and I have found it much
>simpler to do it to the text file BEFORE I open it with OO. The
>following is a solution I use on Linux, but it could be adapted to
>Windows if that is what you are using (find NAWK for Win). On my system
>the 2 files are in $HOME/bin which is in my $PATH. It works pretty well,
>creates a new text file with one (very long) line per paragraph. It
>assumes that either an indent or a blank/null line signals a new paragraph.
>
>OO is great, but sometimes a different tool does the job better.
>
>makedoc:
>awk -f ~/bin/flowdoc.awk $1.txt >otherformats/$1.doc
>
>flowdoc.awk:
>BEGIN {bfr = "";
> }
>/^[ ]*$/ { if (length(bfr) > 0)
> { print bfr;
> bfr = "";
> }
> next;
> }
>/^$/ { if (length(bfr) > 0)
> { print bfr;
> bfr = "";
> }
> next;
> }
>/^ / { if (length(bfr) > 0)
> { print bfr;
> bfr = "";
> }
> for (ix = 1;ix <= NF;ix++)
> bfr = bfr $ix " ";
> next;
> }
> { for (ix = 1;ix <= NF;ix++)
> bfr = bfr $ix " ";
> next;
> }
>END { if (length(bfr) > 0)
> print bfr;
> }
>
>Jim Hartley
Thanks Jim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]