LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-16-2012, 02:22 PM   #1
for_u_day@yahoo.com
LQ Newbie
 
Registered: Feb 2012
Posts: 7

Rep: Reputation: Disabled
Shell script which can print desired pages from the document


Hi,
I wanted to know if there is a shell script which can be used which would have the capability to print the desired page from the document that is
If i have a document named raj.txt and it has 30 pages. If i wish to print it to a printer the 3rd page . I wanted to know whether that is possible through shell scripting.

Please do the needful at the earliest.

With Regards
Raj
 
Old 02-16-2012, 02:32 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,245

Rep: Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431
Quote:
Originally Posted by for_u_day@yahoo.com View Post
Hi,
I wanted to know if there is a shell script which can be used which would have the capability to print the desired page from the document that is
If i have a document named raj.txt and it has 30 pages. If i wish to print it to a printer the 3rd page . I wanted to know whether that is possible through shell scripting.

Please do the needful at the earliest.
Yes, it's possible...again, as in your other thread with a very similar 'question', you just need to WRITE the shell script. If you need help, post what you've written, and where you're stuck, and we can assist. We are NOT going to write your script FOR YOU though....
 
Old 02-17-2012, 02:14 AM   #3
for_u_day@yahoo.com
LQ Newbie
 
Registered: Feb 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks for your reply.

Please let me know what command can be used to accomplish this requirement that is print a specific page from the document.
what i have written so far , is as follows

Pseudo code:
1)If the file exists in that folder
2)then recognize that file
3) <I am waiting to know the command which will help me to print the file pointing at a specific printer.>
4) Once printing is sucessful , archive the file by removing it from the present folder.

Waiting for your helping hand on this.

With Regards
Raj
 
Old 02-17-2012, 10:56 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,245

Rep: Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431Reputation: 4431
Quote:
Originally Posted by for_u_day@yahoo.com View Post
Thanks for your reply.
Please let me know what command can be used to accomplish this requirement that is print a specific page from the document.what i have written so far , is as follows

Pseudo code:
1)If the file exists in that folder
2)then recognize that file
3) <I am waiting to know the command which will help me to print the file pointing at a specific printer.>
4) Once printing is sucessful , archive the file by removing it from the present folder.
Again, you provide no details. Without knowing what the data is (plain text? Formatted? Already have page-breaks in it? Encoded like a PDF? What??), there's little we can tell you. The standard print command is "lp" (read the man page on it), but without knowing what the data is going IN, and what kind of printer/output you're looking for, what can we tell you?? A good pseudo-code example for a bunch of plain text would be:
  • Figure out how many lines/columns you can fit on a page
  • Have your script count that many lines, which would build a page
  • Send that page to the printer
Also, post your real code, not your pseudo code.
 
Old 02-17-2012, 01:41 PM   #5
uhelp
Member
 
Registered: Nov 2011
Location: Germany, Bavaria, Nueremberg area
Distribution: openSUSE, Debian, LFS
Posts: 205

Rep: Reputation: 43
Do read "cups" man pages.

Und enter something like:
Code:
lp -o page-ranges=1-4,7 filename
prints pages from 1 to 4 and page 7 from the file "filename"

Last edited by uhelp; 02-17-2012 at 01:43 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to print lines when debugging shell script shayke23 Linux - Software 3 03-07-2011 04:54 AM
Shell Script to Remove Malicious Code from Web Pages bahbahthelamb Linux - Enterprise 1 05-12-2009 07:10 PM
print 1 to 100 in a shell script sleeper0110 Programming 5 11-02-2008 05:55 AM
shell script to print ldap users cmontr Programming 3 08-19-2008 02:43 PM
How to print my process id using shell script ik_nitk Programming 4 06-07-2007 01:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration