I am very new to NAWK programming so this question is probably going to sound really stupid:
I have a NAWK script which contains a DO loop. During each loop it runs a FORTRAN program which in turn generates two output files , each one containing 2 integer variables. I would appreciate it very much if someone could tell me how I can read in these two files and save the two integer numbers to variables so I can use them later on in the NAWK script? Thanks in advance.
Basically I am trying to run the "choose_lib" program which is a FORTRAN program that takes 6 arguments. It then dumps two integer values to a file called "outf1" and a further 2 two integers to another file called "outf2".
Firstly,
you don't need the intermediate 'runfile' - you can do it all natively in 'awk'
Secondly,
you need to close the FieldDescriptors of the commands you run - you might run out of the FDs allocated to awk - this number of the FDs differs from awk to awk, but is limited [6 for Solaris' 'awk'.
Here's something to try [I use single-quoted parameters to the executable just in case if any of them have embedded spaces]:
nawk -v q="'" -f myAWKscript.awk myInputFile