Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-06-2015, 09:40 AM
|
#1
|
LQ Newbie
Registered: Nov 2007
Posts: 21
Rep:
|
Bulk printing of Billing files in ps (PostScript) format
I have something like 50K *.ps (PostScript) files, these are basically billing files generated from data center. Now we want to read and select files based on some aspects like
1. Billed amount greater then (say) INR 2000
2. Billing address or Pincode matches a given value
I know this can be achieved by awk and sed, the problem begins here, I Don't know how to do it, also I am almost a newbe when it comes to shell scripting, so can somebody help me in writing a script whereby I can read the files, get their filename and then pass on to printer (with lpr) to print the files.
Also, if their is already a solution to these on Linux or Windows platform, then please suggest the software also.
Last edited by nileshkumar; 03-06-2015 at 09:42 AM.
|
|
|
03-06-2015, 01:05 PM
|
#2
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,530
|
If (like me) you're unfamiliar with awk/sed why not run ps2ascii on them, which should give you 50k text files. Then, use grep/egrep on the text files? ps2ascii comes with a few other utilities as part of ghostscript.
|
|
|
03-06-2015, 03:18 PM
|
#3
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,666
|
Quote:
Originally Posted by nileshkumar
I have something like 50K *.ps (PostScript) files, these are basically billing files generated from data center. Now we want to read and select files based on some aspects like
1. Billed amount greater then (say) INR 2000
2. Billing address or Pincode matches a given value
I know this can be achieved by awk and sed, the problem begins here, I Don't know how to do it, also I am almost a newbe when it comes to shell scripting, so can somebody help me in writing a script whereby I can read the files, get their filename and then pass on to printer (with lpr) to print the files.
Also, if their is already a solution to these on Linux or Windows platform, then please suggest the software also.
|
There are many bash scripting tutorials you can find with a brief Google search. The ones on tldp are excellent, so start there. We can HELP you, so post what YOU have written/tried so far. But after using Linux for 8 years now, you should have some ideas.
loop through the files, and grep for a pattern. If you find it, run a command. Simple logic, and there are many example scripts you can find.
|
|
|
All times are GMT -5. The time now is 09:26 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|