i am using a bash terminal and i have a .txt file in which i got three columns of Hex numbers separated by a space. I'd like to convert them to decimal numbers. I tried the last command from here Converting hexadecimal to decimal using awk or sed but it converts the first column only, put a comma among the columns and put a 0 on the second and third columns. to have a more clear idea of what i have and what i want:
Input
30c8 ffbc 3e80
30c8 ffbc 3e81
Output:
12488 65468 16000
12488 65468 16001
Another approach would be to say:
$ while read a b c; do echo $((16#$a)) $((16#$b)) $((16#$c)); done < inputfile
12488 65468 16000
12488 65468 16001
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With