I am trying to print particular set of pages using lp
command, but page-ranges option is not getting me the exact pages.
lpr -o page-ranges=1,3,5,6,9 filename
lp knows the option -P to set a page list
-P page-list
Specifies which pages to print in the document. The list can contain a list of numbers and ranges (#-#) separated by commas (e.g. 1,3-5,16). The page numbers refer to the output pages and not the document's original pages - options like "number-up" can affect the numbering of the pages.
There's a linux utility that will help you with this task called seq
.
See:
echo $(seq -f "%g," 1 2 10) # prints all odd numbers from 1 to 10
lp -P $(seq -f "%g," 1 2 10) filename.pdf # prints odd pages from 1 to 10 of filename.pdf
Read seq --help
to learn more :D
lp -P 1,3,5,6,9 filename