awk command and loops
Hello,
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 |
Sorry, but your text description really isn't detailed enough. Could you please post a short example of the input text (or a reasonable facsimile) and the desired output you want from it?
Also be sure to tell us if there's anything unusual about your environment, such as if you're on a non-linux system. |
Quote:
|
Quote:
I'm going to try a break it up a little Let Input be input.txt Let Output be POS-001.txt LoopStart from Input 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 ) Repeat Loop 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 |
All times are GMT -5. The time now is 06:04 AM. |