How to most easily convert floating point numbers to decimals using shell (bash) tools? For example: I have 0.17879D-13
as input and want 0.000000000000017879
as output. I have tried awk
and bc
but couldn't succeed.
Now I got something. I use sed to replace "D" by "e" then awk can process it, eg:
echo 0.17879D-13 | sed s/D/e/g | awk '{printf("%.20f\\n",$1)}'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.