I have some 100 files with extension .tmp The files are named as 1.tmp, 2.tmp, 3.tmp until 100.tmp
All files look like this:
0.38701788 1.968068e-02
0.38622013 2.054002e-02
0.38350296 1.715522e-02
0.38282126 1.781283e-02
0.38282126 1.781283e-02
0.35847232 1.026839e-02
0.3557739 8.556013e-03
0.35375914 1.318722e-02
0.35018 1.884645e-02
0.3486718 9.611522e-03
I want to multiply each line with two different numbers and then add the result to store the result in a separate file.
For example, this is what I need to do:
0.38701788*0.3 +1.968068e-02*0.5
0.38622013*0.3 + 2.054002e-02*0.5
0.38350296*0.3 + 1.715522e-02*0.5
0.38282126*0.3 + 1.781283e-02*0.5
0.38282126*0.3 + 1.781283e-02*0.5
0.35847232*0.3 + 1.026839e-02*0.5
0.3557739*0.3 + 8.556013e-03*0.5
0.35375914*0.3 + 1.318722e-02*0.5
0.35018*0.3 + 1.884645e-02*0.5
0.3486718*0.3 + 9.611522e-03*0.5
I want to store the result of each file line by line in *.res file.
I am not sure whether I am doing this correctly because the second column has exponential numbers. I am using Linux.
for num in `seq 1 100`; do
number1=awk '{$1=""}1' * 0.3
number2= awk '{$2=""}1' *.5
number1+number2 >$num.res
done
My output for above case should be like this, but I am not getting that:
0.021450876
0.021856614
0.020082699
0.020391053
0.020391053
0.015888365
0.014951224
0.017206384
0.019928625
0.015265915