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