[Top][All Lists]

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

Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana

From: Ralph Corderoy
Subject: Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana
Date: Mon, 17 Apr 2023 13:15:50 +0100

Hi Branden,

>     pdfinfo \
>     | tr -d '\000' \
>     | sed -n -e '/Page *size:/s/Page * size: *\([0-9.]*\) *x * 
> \([0-9.]*\).*$/\.nr pdfpic*width (p;\1)\
>     .nr pdpic*height (p;\2)/;tprint
>     b
>     :print
>     p'

Why the dance with ‘tprint’?  sed -n s/foo/bar/p

The \ in \.nr isn't needed.  It isn't in the other one.

To match one or more p's in a BRE, the idiom is pp* rather that p*p.
Though I'm not sure it's necessary here for the spaces.

The substitution's address is different from its pattern in that
‘Pagesize:’ matches the former but not the latter.

One could

    sed -ne '/^Page *size: *\([0-9.][0-9.]*\) *x *\([0-9.][0-9.]*\).*$/s//.nr 
pdfpic*width (p;\1)\
    .nr pdpic*height (p;\2)/p'

Its idiomatic to have the pipe at the end of the line.
By design, this also avoids the backslash clutter in the shell.

Cheers, Ralph.

reply via email to

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