Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Convert value from scientific notation to decimal in shell?

How to convert value from scientific notation to decimal in shell? (preferred C shell)

Also I'd want to convert it from e-12 to e-9 and then shell

42.53e-12 to 0.04253. I have to do this for a list.
by

1 Answer

Kajalsi45d
printf will do this for you, from shell.
 $ FOO=42.53e-12
$ BAR=$(printf "%.14f" $FOO)
$ echo $BAR
0.00000000004253
$


In ancient+arcane C-shell, this would be.
$ set FOO=42.53e-12
$ set BAR=`printf "%.14f" $FOO`
$ echo $BAR
0.00000000004253
$

Login / Signup to Answer the Question.