Hope you can help me get started with these trivial questions.
I’ve got a practical problem, and the Ruby cookbook to help me, but a
few combinations of the two haven’t produced any interesting results
yet. I’d need a simple useful example to start with and then make my
Here is my practical problem:
- I open a text file, locate a line according to some keyword or line
number, and change a value
- I run a fortran program
- I read a text file (output of this program), extract several
numerical values and export them in a two column text file
The way I’ve done that so far is using bash commands such as ‘awk’,
‘grep’, … but i need some loops and it’s getting too big for a
sensible bash script.
Could you help me get started in Ruby with the simpler example below?
Here is the content of “sampleTextFile.dat”:
other useless words …
I would like to read this data in some sort of array/hash, and export
the first column and the product of the last two columns to a new
file “results.dat”. This should be enough to understand the spirit I
guess, with the probably trivial problem to call the external program.
Any advice welcome.
Many thanks in advance!