• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

how do i print selected pages from a file ?

I would like to print pages 10 to 1001 form a file which has 7011 pages. How do i send this to a printer via a unix line command ?
0
ndamaseki
Asked:
ndamaseki
1 Solution
 
elfieCommented:
Can you use 'pr?

pr +10 filename, start printing from page 10.

some soemthing like

pr +10 filename | head -60000 | lp,    
should do (1000 page times 60 lines)
0
 
chris_calabreseCommented:
It depends on how you're printing the file.

If it's pre-formatted ascii test, you can slice out the exact line numbers (66 lines to the page) with something like
  awk 'NR > 660 && NR <= 66066 { print }' <FILENAME> | lp


If it's free-form ascii text, you can use the pr technique recommended by elfie.

If it's PostScript you can probably write some PostScript wrapper code that would do this, but my PS skills are too rusty these days to figure out exactly how to do it.  You might also be able to bring it into a PostScript viewer like ghostview and print the pages you want from there.

If it's some other type of application file, you'll need to use whatever facilities the application has for doing this sort of thing.
0
 
yuzhCommented:
You need to tell which favour of UNIX and what type of file you want to print.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
ahoffmannCommented:
beside the suggested solution, I assume you're looking for a solution spezialised for **your** flaviour of UNIX, and **your** printing system. Then please tell us these details, also the format of the file (plain text, PostScript, etc.)
There're to much ways to do it, or to say "not possible" as we can suggest each.
0
 
ndamasekiAuthor Commented:
Yuzh and ahoffmann,

The Unix flavour is Digital or Compaq Unix 4.0E. The format is plain text.
0
 
ahoffmannCommented:
see chris_calabrese's sugestion.
You may also use sed or tcl or perl instead of awk ...

     sed -n -e '660,66066 p' file|lp
0
 
tfewsterCommented:
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:

- Answered by chris_calabrese

Please leave any comments here within the next 7 days

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster
Cleanup Volunteer
0
 
SpideyModCommented:
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now