Alright, I cannot figure out how to do this.
I have a fileA
which looks like this :
([7]RIMS_ID) : "CNR"
(refGain_A[7]) : 1
(RIMSclockBias_A[7]) : -398015316.7
(RIMSclockDrift_A[7]) : -6442.29
(RIMSclockSigma_A[7]) : .01
(RIMSclockSigY_A[7]) : 0
([8]RIMS_ID) : "ABS"
(refGain_A[8]) : 1
(RIMSclockBias_A[8]) : -374515458
(RIMSclockDrift_A[8]) : -6442.29
(RIMSclockSigma_A[8]) : .01
(RIMSclockSigY_A[8]) : 0
and so on where the [index] goes from 0 to 71 and each station has a different ID.
I want to replace the value corresponding to RIMSclockBias_A
string of each station with a value I have on another fileB
like this:
CNR -44163754.49
ABS 3417370.112
...
So to have:
([7]RIMS_ID) : "CNR"
(refGain_A[7]) : 1
(RIMSclockBias_A[7]) : -44163754.49
(RIMSclockDrift_A[7]) : -6442.29
(RIMSclockSigma_A[7]) : .01
(RIMSclockSigY_A[7]) : 0
([8]RIMS_ID) : "ABS"
(refGain_A[8]) : 1
(RIMSclockBias_A[8]) : 3417370.112
(RIMSclockDrift_A[8]) : -6442.29
(RIMSclockSigma_A[8]) : .01
(RIMSclockSigY_A[8]) : 0
I can isolate the correct field with a combination of grep
in a for
loop and awk
, but I don't know how I can replace the value in the file itself. sed
needs to know the exact value I want to replace as input so it is not feasible.
Any idea?
-> (RIMSclockBias_A[0]) : -490697.2517
or for ALB (RIMSclockBias_A[2]) : 11074942.05 -> (RIMSclockBias_A[2]) : -490697.2517
and so onwhile my fileB has:
ABS -44163754.49 ALB -37625043.3
I don't see where is the problem with your code.
– Dad85 May 24 '16 at 07:46clockBias
in random locations in every paragraph and it still works OK). I can only work with the input sample that you provide so I cannot know what's wrong on your side... (there could be a lot of things from hidden funky chars in your file to windows line endings or whatnot). – don_crissti May 24 '16 at 10:04