perl - How can I sum up the exponent value in bash shell? -


here example values

2.31312e+06 4.34234234e+07 4.578362e+06 3.213124124e+06 

how can add them?

numbers args:

perl -le'$s += $_ @argv; end { print $s }' 

numbers on stdin or file named argument (one per line):

perl -nle'$s += $_; end { print $s }' 

use printf '%e\n', $s instead of print $s if want result in exponent notation.


Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -