groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Line continuation


From: Keith Marshall
Subject: Re: [Groff] Line continuation
Date: Sun, 26 Oct 2008 14:17:11 +0100
User-agent: KMail/1.9.9

On Sunday 26 October 2008 11:27:38 Ralph Corderoy wrote:
> To change the sed script to treat a backslash at the end of the
> line as the continuation marker, you just need to be aware that it
> needs escaping with another, like Perl.
>
>     sed ':l;/\\$/{N;s/\\\n *//;b l}'

I too would choose sed, but do be aware of a possible pitfall in the 
above: POSIX demands that the closing brace of a command group be 
separated from the preceding command, by a newline.

Recent versions of GNU sed relax this requirement, and accept the 
above; some earlier versions may choke on it, but accept

    sed ':l;/\\$/{N;s/\\\n *//;b l;}'

(note the additional semicolon).  For strict POSIX conformance, it 
should be written as

    sed -e':l;/\\$/{N;s/\\\n *//;b l' -e'}'

or

    sed ':l;/\\$/{N;s/\\\n *//;b l
         }'

(spanning two lines, with a newline within the quoted expression).

Regards,
Keith.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]