groff
[Top][All Lists]
Advanced

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

Re: Sed failure in contrib/sboxes on MacOS


From: G. Branden Robinson
Subject: Re: Sed failure in contrib/sboxes on MacOS
Date: Wed, 27 Oct 2021 15:44:00 +1100
User-agent: NeoMutt/20180716

Hi, Andreas!

At 2021-10-26T23:56:47+0200, Andreas Kusalananda Kähäri wrote:
> If you insert a semicolon or a newline after the b command, you will
> make it more portable.  Also, there is no need to repeat the regular
> expression a second time.
> 
>       /\\##/ { s///; b; }

Thanks for these tips.  I'm afraid my lack of mastery of sed is revealed
in flaming letters.

> or even just
> 
>       s/\\##//
>       t

This suggestion, however, did not work for me as-is[1].  However, I
liked the idea of not introducing a brace scope, and I was able to
resequence the substitutions to get what I wanted.

> The sed script also has another substitution further up that requries
> GNU sed:
> 
>       s/.*\\##.*/&\n&/
> 
> POSIX sed can't insert a newline with its s command using \n.  However,
> the following would be portable:
> 
>       s/.*\\##.*/&\
>       &/
> 
> That is, escape the literal newline.

I've taken this suggestion as well.

I'll follow up separately regarding the make/sh/sed mess.

Thank you very much for sharing your sed expertise.  I've pushed the
relevant commit[2].  The generation of the  msboxes.pdf document not
only fails to provoke sed warnings on Mac OS X now, but the output
looks correct under visual inspection as well.

Regards,
Branden

[1] The substitution 's/\\" FOOTNOTE/@FOOTNOTE@/' is _not_ performed on
    most lines of the input.
[2] 
https://git.savannah.gnu.org/cgit/groff.git/commit/?id=91e44e4f0544cd8ab4def74514074e4c22ecec33

Attachment: signature.asc
Description: PGP signature


reply via email to

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