Solved

how do i print selected pages from a file ?

Posted on 2002-04-22
8
245 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

760 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