我使用了下面的 awk 命令
awk -F ':' '
{ s3 += $3; }
{ s4=s4+$4; }
{ s5=s5+$5; }
END { print s3,","s4,","s5,","s3/s5 }' sample.txt > sample1.txt
我的输入文件(sample.txt)是:
05/05/2013:0:47623.49:1007:180
05/05/2013:1:35959.84:1959:132
05/05/2013:2:26317.05:690:85
05/05/2013:3:8715.40:107:32
05/05/2013:4:5713.27:66:24
05/05/2013:5:10533.34:1025:17
05/05/2013:6:10748.54:602:58
05/05/2013:7:44429.87:1644:203
05/05/2013:8:97096.44:4320:415
05/05/2013:9:148065.87:6603:639
05/05/2013:10:194488.19:8426:900
05/05/2013:11:231119.09:10991:986
05/05/2013:12:263701.11:10771:1070
05/05/2013:13:275892.40:10005:1054
05/05/2013:14:272595.88:9702:1120
05/05/2013:15:286506.75:10953:1110
05/05/2013:16:119102.11:4298:504
但命令会自动四舍五入,输出为:
2078610.00,83169 ,8529 ,243.711
我希望输出为2078609.56
(没有四舍五入的精确值),如何在 awk 中实现这一点?