如何在AWK删除科学记数法? [英] How remove scientific notation in awk?
本文介绍了如何在AWK删除科学记数法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在下面的awk命令
awk '{sum+=$1; ++n} END {avg=sum/n; print "Avg monitoring time = "avg}' file.txt
我应该改变删除科学记数法输出(显示为1.5E-05非常小的值)?
what should I change to remove scientific notation output (very small values displayed as 1.5e-05) ?
我无法与OMFT变量成功。
I was not able to succeed with the OMFT variable.
推荐答案
您应该使用 的printf
AWK声明。您可以指定填充,precision等。在你的情况那样的话,<一个href=\"http://www.gnu.org/software/gawk/manual/html_node/Control-Letters.html#Control-Letters\"><$c$c>%f$c$c>控制信似乎更为合适。
You should use the printf
AWK statement. That way you can specify padding, precision, etc. In your case, the %f
control letter seems the more appropriate.
这篇关于如何在AWK删除科学记数法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文