Hi guys I have the following lines:
A=3.5e30
B=4.345e40
(File contains columns with numbers in this notation 1.2345678D+10)
sed 's/D/E/g' File | awk '{print $1, $6*'$A', 10^($9)*'$B', $13, $8}' > File2
The output that I'm getting is:
3.168808781403E+02 29825999184755995994350665720659968 71343531834366140263241767594070376448 ... etc
How can I have the 2nd and 3rd column with the same notation as in the first column? I.e,
Instead of having : 71343531834366140263241767594070376448
I want: 7.134353183436E+37
Just to let you know the answer is:
sed 's/D/E/g' File | awk '{printf "%.12E %.12E %.12E %.12E %.12E\n", $1, $6*'$A', 10^($9)*'$B', $13,$8 }' > File2
If you want the so called scientific notation use printf and %E
format specifier.
Example:
echo 71343531834366140263241767594070376448 | awk '{printf "%E",$1}'
Output:
7.134353E+37