Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


how do i print selected pages from a file ?

Posted on 2002-04-22
Medium Priority
Last Modified: 2012-05-04
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 ?
Question by:ndamaseki
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 6959389
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)
LVL 14

Accepted Solution

chris_calabrese earned 800 total points
ID: 6960373
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.
LVL 38

Expert Comment

ID: 6961629
You need to tell which favour of UNIX and what type of file you want to print.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 51

Expert Comment

ID: 6962458
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.

Author Comment

ID: 6964776
Yuzh and ahoffmann,

The Unix flavour is Digital or Compaq Unix 4.0E. The format is plain text.
LVL 51

Expert Comment

ID: 6964911
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
LVL 21

Expert Comment

ID: 7921067
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


Cleanup Volunteer

Expert Comment

ID: 7967052
per recommendation

Community Support Moderator @Experts Exchange

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question