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
 


wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
8,660
Reaction score
7,607
Credits
35,522
Welcome to linux.org

Moving this to Command Line.

Is this homework?

Chris Turner
wizardfromoz
 
OP
P

PonDioS

New Member
Joined
Sep 24, 2022
Messages
2
Reaction score
0
Credits
18
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
 

Lexyan

New Member
Joined
Sep 25, 2022
Messages
1
Reaction score
0
Credits
7
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
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Members online


Latest posts

Top