Multiplying the decimals in the column

PonDioS

New Member
Joined
Sep 24, 2022
Messages
2
Reaction score
0
Credits
18
Hi, I want to multiply only the second column by 27.211396132 . I use

awk '{$2=$2*27.211396132 ; print }' input file > output file

The result is wrong . I want the answer to be like 5 -76308.842049 ( for the first line). Please help me.


input file.png
output file.png

input file output file
 


Welcome to linux.org

Moving this to Command Line.

Is this homework?

Chris Turner
wizardfromoz
 
no it's not, I’m converting eV units from hartree but I need to save time I can't calculate each one by one
 
OK, thanks - someone will be along when they can. Good luck.

Wizard
 
Your decimal separator seems inconsistent between input and output

Try changing LC_NUMERIC to reflect input locale
LC_NUMERIC=en_US.UTF-8 awk --use-lc-numeric '{$2=$2*27.211396132 ; print }' input file > output file
 

Staff online

Members online


Top