Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to specify page ranges to print in AIX?

Status
Not open for further replies.

baggetta

Technical User
Feb 27, 2003
116
US
Is there a way to specify print pages 1-30 from a file that does have page breaks in it using either lp or lpr?
 
Have you done a man lp? This is what it says:

-P PageList Prints the pages specified in PageList. This flag can be used only if there is a filter available to handle it; otherwise, the print request is rejected. The PageList may consist of ranges of numbers, single page numbers, or a combination of both. The pages are printed in ascending order.

 
The only way I can think of is to use head to grab the first 30 pages to a temp file, then print that...

--
| Mike Nixon
| Unix Admin
|
----------------------------
 
How do you use "head" to grab the first 30 pages?
 
With AIX printing you can use the qprt -g 30 flag to start printing at page 30, but not to stop at that point. This only works for ASCII text files where the _d attribute = a for the virtual printer (not formatted PS or PCL)

The head command will only work if you have the same number of lines on each page. Then say your pages are all 60 characters long 30*60=1800 so you use head
qprt -1800 filename | qprt -Pqueue

If you want to use the lp command as described earlier with a shell script interface script, then you would have to use the System V printing mode available in AIX 5.1 and later.

Another option with qdaemon based printing is to write a custom backend. It's not really too hard, or to try to use another filter. You can also do some nice formatting with the pr filter, but it won't meet the needs here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top