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

  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 Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 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 01-31-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 30 July 2014, 6:29 PM EDT
Location: NM
Posts: 10,160
Thanks: 269
Thanked 781 Times in 731 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 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 01-31-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 30 July 2014, 6:29 PM EDT
Location: NM
Posts: 10,160
Thanks: 269
Thanked 781 Times in 731 Posts

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

where ^L is ctrl-L.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 12:56 PM
Printer won't print but 1 page slak0 Slackware 2 04-09-2012 03:26 PM
Print Specific lines when found specific character attila Shell Programming and Scripting 4 01-26-2012 04: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 03:24 PM
lpr- how to print from page to page naamas03 Shell Programming and Scripting 4 12-26-2007 05:30 AM



All times are GMT -4. The time now is 07:14 PM.