Formatting a number in ksh
Hi everyone,
I'm having trouble formatting a number from scientific notation to floating point (or double) in ksh (Linux). For example, suppose I have a one-column text file named "old_text_file.txt" with the following entries:
3829934.024532
3829902.093483
3829952.043321
Next, suppose I want to add a number (3.00 for example) to every line in this column and write the result to a new file named "new_text_file.txt". I would do the following:
3.829937e+06
3.829905e+06
3.829955e+06
My question: Is there a way for me to force the results to be written to the new text file in floating point (or double) format instead of the scientific (e+06) format so that the results are printed as follows?
3829937.024532
3829905.093483
3829955.043321
Thanks in advance!
geodave
I'm having trouble formatting a number from scientific notation to floating point (or double) in ksh (Linux). For example, suppose I have a one-column text file named "old_text_file.txt" with the following entries:
3829934.024532
3829902.093483
3829952.043321
Next, suppose I want to add a number (3.00 for example) to every line in this column and write the result to a new file named "new_text_file.txt". I would do the following:
awk '{print ($1+3.00)}' old_text_file.txt > new_text_file.txt
which gives me the following entries in the new text file:3.829937e+06
3.829905e+06
3.829955e+06
My question: Is there a way for me to force the results to be written to the new text file in floating point (or double) format instead of the scientific (e+06) format so that the results are printed as follows?
3829937.024532
3829905.093483
3829955.043321
Thanks in advance!
geodave
0
Comments