On Sat, 30 Mar 2002, ephemeron wrote:

> What's the proper way to open or import a text file with hard-coded line
> breaks (contents reproduced below). I want each group of lines that end
> with a blank line to be grouped into a single paragraph. Opening the
> file as "Text" produces an Abi document with poem-like breaks (stanzas,
> rather than paragraphs, of text).

I hacked together a quick C program to handle this by converting a file in
the format you mention to one where each paragraph is a single line. The
result can then be imported into a word processor and is correctly
formatted. I haven't actually tested it with Abiword, but I am sure it
will work. Source code follows:

#include <stdlib.h>
#include <stdio.h>

int main( int argc, char *argv[] )
{
        char c, d;
        
        d = '\0';
        while ((c = getchar()) != EOF)
        {
                if (c != '\n' || d == '\n')
                        putchar( c );
                else if (d != ' ')
                        putchar( ' ' );
                d = c;
        }
        
        return 0;
}

-- 
Mario Becroft <[EMAIL PROTECTED]>
http://gem.win.co.nz/mb/

-----------------------------------------------
To unsubscribe from this list, send a message to
[EMAIL PROTECTED] with the word
unsubscribe in the message body.

Reply via email to