I'm having a bit of trouble with getting awk to read scientific notation from a file, here is some example input:
#Plane Turn Real Imaginary
HOR 1 0.0000e+00 -2.1885e-07
HOR 1 4.8481e-08 -8.1221e-08
HOR 1 4.0934e-08 -6.0784e-08
HOR 1 3.5707e-08 -5.1223e-08
HOR 1 3.1664e-08 -4.5608e-08
HOR 1 2.8268e-08 -4.1964e-08
HOR 1 2.5242e-08 -3.9469e-08
HOR 1 2.2429e-08 -3.7707e-08
HOR 1 1.9731e-08 -3.6430e-08
HOR 1 1.7082e-08 -3.5479e-08
I'm using awk to format this file for plotting with gnuplot using the following command:
gnuplot "awk '{if($2==1){printf "%.4e\n",sqrt($3^2+$4^2)}}' bathtub_values.dat" w l
However the arithmetic is not working correctly and after a few tests I realized that awk doesn't seem to correctly interpret the input format, how can I specify to awk the format to use?
If you're not entitled to install a different awk, you can define and use a function to parse the engineering notation