linux 中 将科学计数法表示的数值转换成普通数值、普通数值转换为科学计数法表示

 

001、

[root@pc1 test2]# ls
a.txt
[root@pc1 test2]# cat a.txt                                ## 测试数据
snp2037 475     65      -7.77868e-06
snp5835 646     65      -7.77868e-06
snp5837 650     65      -7.77868e-06
snp8425 411     55      0.920459
snp6079 1272    54      3.05355e-05
snp1674 99      59      6.35763e-05
[root@pc1 test2]# awk '{printf("%.10f\n", $4)}' a.txt      ## 科学数字转换为普通数值
-0.0000077787
-0.0000077787
-0.0000077787
0.9204590000
0.0000305355
0.0000635763
[root@pc1 test2]# awk '{printf("%e\n", $3)}' a.txt         ## 普通数值转换为科学计数表示
6.500000e+01
6.500000e+01
6.500000e+01
5.500000e+01
5.400000e+01
5.900000e+01

 

posted @ 2023-01-12 11:40  小鲨鱼2018  阅读(251)  评论(0编辑  收藏  举报