Quantcast
Channel: Convert floating point numbers to decimal numbers - Unix & Linux Stack Exchange
Browsing all 5 articles
Browse latest View live

Answer by user79743 for Convert floating point numbers to decimal numbers

This will do the conversion: awk '{print $1, $2, $3 * 10**$4}' file.csv Assuming: There is an space bettween the e and the actual exponent. The exponent is the last field of each line. If an specific...

View Article



Answer by mikeserv for Convert floating point numbers to decimal numbers

{ sed 's/ /+/3' | xargs printf '%G% G% G\n'; } <in >out 1 1 1423 1 2 1589 1 3 85000 1 4 8900 1 5 8796 You'll wanna play around with the %G precision flags if the numbers get much larger than that.

View Article

Answer by Costas for Convert floating point numbers to decimal numbers

Other variant with awk sprintf awk 'NF==4{$(NF-1)=sprintf(CONVFMT, $(NF-1)$NF);NF=3}1' file

View Article

Answer by cas for Convert floating point numbers to decimal numbers

The sed script gets rid of the space after the 'e', and the awk script just prints out each field (multiplying $3 by 1 to "convert" it to a non-fp decimal number): $ sed -e 's/e /e/g' file | awk...

View Article

Convert floating point numbers to decimal numbers

I have several 'ascii' tables in a directory, some of them have numbers expressed in decimal and some others ones in floating point, as follow: 1 1 1423 1 2 1589 1 3 0.85e 5 1 4 0.89e 4 1 5 8796 ......

View Article

Browsing all 5 articles
Browse latest View live




Latest Images