Solved

how do i print selected pages from a file ?

Posted on 2002-04-22
8
256 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
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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 20

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AIX 5.3 group password policy changes 7 27
Shell script errors 10 113
Virtualizing TAPE on dual VIOS 3 75
unix in java example 9 53
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

912 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now