[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.
- Re: groff 1.23.0.rc4 on FreeBSD, (continued)
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, Bruno Haible, 2023/04/15
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, G. Branden Robinson, 2023/04/15
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, Bruno Haible, 2023/04/16
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, Ralph Corderoy, 2023/04/16
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, Bruno Haible, 2023/04/16
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, G. Branden Robinson, 2023/04/17
- Re: sed portability, Bruno Haible, 2023/04/17
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana,
Ralph Corderoy <=
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, G. Branden Robinson, 2023/04/19
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, G. Branden Robinson, 2023/04/19
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, Dave Kemper, 2023/04/20
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, G. Branden Robinson, 2023/04/20
- Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana, Dave Kemper, 2023/04/21
Re: groff 1.23.0.rc4 available for testing, Dave Kemper, 2023/04/24