[GTALUG] bash seq question

William Park opengeometry at yahoo.ca
Thu Feb 2 19:25:54 EST 2017


On Thu, Feb 02, 2017 at 06:06:45PM -0500, Russell Reiter via talk wrote:
> It's not often I have to assemble larger numbered documents. I usually use
> this little script.
> 
> enscript -L1 -F --header-font=Times-Roman12 -b '||$%' -o- < <(for i in
> $(seq "$(pdftk "$1" dump_data | grep "Num" | cut -d":" -f2)"); do echo;
> done) | ps2pdf - | pdftk "$1" multistamp - output "${1%.pdf}-numbered.pdf"

I can't read this.  Re-writing...

enscript -L1 -F --header-font=Times-Roman12 -b '||$%' -o- < <(
    for i in $(
	seq "$(pdftk "$1" dump_data | grep "Num" | cut -d":" -f2)"
    ); do 
	echo
    done
) | ps2pdf - | pdftk "$1" multistamp - output "${1%.pdf}-numbered.pdf"

Maybe you meant,

    seq $(pdftk "$1" dump_data | grep Num | cut -d: -f2)

seq takes number arguments, so you don't need to quote something that
shouldn't be there in the first place.

Also, you are printing empty lines using 'echo'.  Process substitution
will not like it.


> 
> I tried it on this ..
> 
> Linux HECTOR 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19)
> x86_64 GNU/Linux
> 
> and got this ..
> 
> seq: invalid floating point argument:  162
> 
> 162 pages with no numbers.
> 
> Could this be because the pdf's were generated in M$?
> 
> Thanks in advance.
> 
> Russell

> ---
> Talk Mailing List
> talk at gtalug.org
> https://gtalug.org/mailman/listinfo/talk



More information about the talk mailing list