Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 04-08-2015, 12:38 PM   #1
LQ Newbie
Registered: Nov 2007
Posts: 21

Rep: Reputation: 0
Bash or Puthon script to read and print postscript (ps) files from a directory

I am pretty new to Scripting Languages, and was trying to learn Bash Shell Scripting for reading and printing PostScript (PS) files from a directory (which may contain 10000's of files) in Linux environment. Basically you can call it as a bulk print processing job. This script will involve filtering of files bases on some criteria involving both floating point numbers and string characters on which search will be done (something like a 'grep' or 'sed' in Shell), and so involves reading files also.

Now, as I have continued learning Bash Shell Scripting, I came to know about python scripts which typically can do anything which a Shell Script can do and becomes much more efficient when (1)not dealing with system admin task (which in this case is true), and (2)when the file becomes large (typically more then 1000 lines, I think I will get around something 500-600 lines when finished)

So here's my Question, Now that I am learning (from scratch), so should I go with Bash Shell Script or Python Shell Script, given the condition that (1)I am not thinking of making my script portable to other platform, (2)I have basic requirement of dealing with ps files (or some other non-system, text files) and (3)I want to buil a really fexible script which can take input much like any of the Linux native system commands (like, cp, ls, dd etc)
Old 04-08-2015, 12:44 PM   #2
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,890
Blog Entries: 13

Rep: Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934Reputation: 4934
I actually might vote for BASH because I think it's closer to the shell and you'll be using a lot of shell commands. But given your comment about floating point, that would be python. Why that requirement though?
Old 04-08-2015, 12:49 PM   #3
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
personaly i would stick with bash until you hit a point where you need something a little more robust then i would switch. however bash can solve alot and is really quick to implement for an admin
Old 04-08-2015, 12:56 PM   #4
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,322

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i think bash since this command could probably be the basis of your project:
lpr *.ps
but reading your op i'm not able to ascertain of what other tasks you mite need to take care of.

keep us posted.

Last edited by schneidz; 04-08-2015 at 12:58 PM.
Old 04-09-2015, 10:01 AM   #5
LQ Newbie
Registered: Nov 2007
Posts: 21

Original Poster
Rep: Reputation: 0
These are basically Telephone Bills, which needs to be filtered based on different criteria like amount, address and exchange_code, it requires comparing with floating point and strings.

Also, I too was working with bash initially as it represents virtual shell, but then for this particular task, I don't require Admin task.

And then, the most important thing, is yes my command will basically revolve around this command
lpr *.ps

which though I din't thought initially, but then with bash I am not able to find much help in dealing with *.ps files, and neither bash is an intuitive language


bash, python, script

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
[SOLVED] Bash script to read through text files and find largest number in files pomico Programming 15 09-13-2012 01:07 PM
Shell script to read all files from a directory and print the documents Linux - Newbie 1 02-16-2012 01:28 PM
BASH Script --> read a file & cp -r to my ~/ directory manwithaplan Linux - Newbie 6 10-05-2009 11:25 PM
Trouble with making a bash script to read in different files and rename output files. rystke Linux - Software 1 05-07-2009 08:00 AM
To rename files in a directory should I use Bash script or a Perl Script ? jamtech Programming 7 01-22-2008 11:25 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:59 AM.

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