I have a file containing a list of hexadecimal numbers, like 0x12345678 one per line.
I want to make a calculation for them. For this, I thought about using awk . But if printing a hexadecimal number with awk easy using the printf function, I have not found a way to interpret hexadecimal input other than text (or 0 , converting to integer stops on x ).
awk '{ print $1; }' // 0x12345678 awk '{ printf("%x\n", $1)}' // 0 awk '{ printf("%x\n", $1+1)}' // 1 // DarkDust answer awk '{ printf("%s: %x\n", $1, $1)}' // 0x12345678: 0
Is it possible to print, for example. +1 value?
awk '{ printf(%x\n", ??????)}'
Edit: one liner in other languages โโis welcome! (if reasonable length ;-))
source share