I inherited a tcsh "master" script that works and extracts lines from files with data with using 'zcat' piped to 'grep' and some other commands/scripts. The extracted lines contain numbers . It is getting difficult to do the calculations that I need to do on the numbers in the tcsh script , thus I am looking for an alternative that reuses the working
grep and other commands .
I could easily do the calculations in C . Getting the numbers in the program without creating lots of intermediate files is the challenge , as is doing pipes from the output of one command into another .
How can I transform the "master" script to a perl , ruby or python script ? I did not really find the examples in perl and ruby that much more readable than the original tcsh script . In python the os.system calls do not give the contents back , just an exit status , the same problem I would have with using C .
Is there a better way than using os.system in python to get information from programs, scripts or program combinations? Or should I take a closer look at perl or ruby?