How to print a specific page | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Unix/Linux Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

How to print a specific page

UNIX for Dummies Questions & Answers


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-31-2007
randomcz randomcz is offline
Registered User
 
Join Date: Nov 2006
Last Activity: 31 January 2007, 2:10 PM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
How to print a specific page

Hi there,

Does anyone know how to print a specified page using command like lpr?


Thanks,
Sponsored Links
    #2  
Old Unix and Linux 01-31-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 6 March 2015, 4:00 PM EST
Location: NM
Posts: 10,397
Thanks: 323
Thanked 850 Times in 789 Posts
You're better of just creating a tmpfile with the one page and printing that
Assuming 66 lines per page with no page feed (ASCII 12) embedded:

Code:
# $1 = page number
pr +"$1" bigfile | awk 'NR<67' > tmpfile

tmpfile now is a 66 line file to send to lpr
See man pr to change page length
Sponsored Links
    #3  
Old Unix and Linux 01-31-2007
randomcz randomcz is offline
Registered User
 
Join Date: Nov 2006
Last Activity: 31 January 2007, 2:10 PM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
What if there is a page feed embeded?
    #4  
Old Unix and Linux 01-31-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 6 March 2015, 4:00 PM EST
Location: NM
Posts: 10,397
Thanks: 323
Thanked 850 Times in 789 Posts

Code:
sed 's/^L//g bigfile | pr +"$1" | awk 'NR<67' > tmpfile

where ^L is ctrl-L.
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Print multiple copies page by page using lp command megha2525 Shell Programming and Scripting 7 04-20-2012 01:56 PM
Printer won't print but 1 page slak0 Slackware 2 04-09-2012 04:26 PM
Print Specific lines when found specific character attila Shell Programming and Scripting 4 01-26-2012 05:33 AM
print first few lines, then apply regex on a specific column to print results. kchinnam Shell Programming and Scripting 4 08-24-2010 04:24 PM
lpr- how to print from page to page naamas03 Shell Programming and Scripting 4 12-26-2007 06:30 AM



All times are GMT -4. The time now is 09:39 PM.