[GTALUG] bash seq question
Stewart C. Russell
scruss at gmail.com
Tue Feb 7 16:46:35 EST 2017
On 2017-02-06 01:36 PM, Russell Reiter wrote:
> I had to resort to analogue to get the docs out. You remember, print the
> numbers on the pages, then run them through for the data.
Ah, that's annoying.
Your script does seem to be a variant of this, which seems to work:
#!/bin/bash
# from http://stackoverflow.com/a/9033109/377125
input="$1"
output="${1%.pdf}-header.pdf"
pagenum=$(pdftk "$input" dump_data | grep "NumberOfPages" | cut -d":" -f2)
enscript -L1 --header='||Page $% of $=' --output - < <(for i in $(seq
"$pagenum"); do echo; done) | ps2pdf - | pdftk "$input" multistamp -
output $output
Stewart
More information about the talk
mailing list