Solved

how do i print selected pages from a file ?

Posted on 2002-04-22
8
288 Views
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 ?
0
Comment
Question by:ndamaseki
[X]
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
8 Comments
 
LVL 3

Expert Comment

by:elfie
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)
0
 
LVL 14

Accepted Solution

by:
chris_calabrese earned 200 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.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 6961629
You need to tell which favour of UNIX and what type of file you want to print.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Expert Comment

by:ahoffmann
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.
0
 

Author Comment

by:ndamaseki
ID: 6964776
Yuzh and ahoffmann,

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

Expert Comment

by:ahoffmann
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
0
 
LVL 21

Expert Comment

by:tfewster
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

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster
Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7967052
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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 find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

707 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