I have the following file format
...
MODE P E
IMP:P 1 19r 0
IMP:E 1 19r 0
...
SDEF POS= 0 0 14.6 AXS= 0 0 1 EXT=d3 RAD= d4 cell=23 ERG=d1 PAR=2
SI1 L 0.020
SP1 1
SI4 0. 3.401
SI3 0.9
...
NPS 20000000
What I am trying to do is to locate a specific value(in particular the value after the sequence SI1 L
) and create a series of files with different values. For instance ST1 L 0.020
--->ST1 L 0.050
. What I have in mind is to give a start value, an end value and a step so as to generate files with different values after the sequence SI1 L
. For instance a for loop would work, but I don't know how to use it outside awk
.
I am able to locate the value using
awk '$1=="SI1" {printf "%12s\n", $3}' file
I could also use the following to replace the value
awk '$1=="SI1" {gsub(/0.020/, "0.050"); printf "%12s\n", $3}' file
The thing is that the value won't always be 0.020
. That's why I need a way to replace the value after the sequence SI1 L
and this replacement should be done for many values.
How can this be acheived?