Originally Posted by Uzer
I am dealing with the following problem: I am using a software for physics calculations and I use as input for this program a certain .txt file (which I open with emacs). The file contains a series of numbers put in columns. I want to change the element which is found in the 2nd row and in the second column by 0,001 and save this file under the name ("POS") in order to run again the program with "POS" as input file. I want to do this action for 100 steps and it is very tiring to do by hand....
What can I do in the terminal to command this algorithm? so far i found foreach and awk command helpful but i don't know how to use them.
Thank you in advance
I'm Sorry but I don't understand what you want/need.
I'm going to try a break it up a little
Let Input be input.txt
Let Output be POS-001.txt
send line 1 to Output
Line 2 , field 2 .. add (or subtract?) 0.001 ( assuming , was typo )
send new line 2 to POS.txt
send rest of lines to POS.txt
for further 99 times
Let Input be Output
Let Output be Output+1 ( POS-002.txt )
It would help greatly if you provide a sample Input and Output ( 1 and 2 ) ( say 10 lines, or 11 including header )
Do you only want to operate on Line2 ( assuming line 1 is header ), or All Lines