In a UNIX shell script, what can I use to convert decimal numbers into hexadecimal? I thought od would do the trick, but it's not realizing I'm feeding it ASCII representations of numbers.
printf? Gross! Using it for now, but what else is available?
If you want to filter a whole file of integers, one per line:
Hexidecimal to decimal:
Decimal to hexadecimal:
This is not a shell script, but it is the cli tool I'm using to convert numbers among bin/oct/dec/hex:
Tried
printf(1)
?There are probably ways of doing that with builtin functions in all shells but it would be less portable. I've not checked the POSIX sh specs to see whether it has such capabilities.