Command Line Number Conversion

August 7, 2007 – 6:58 pm

Tip courtesy of Kyle Reynolds at http://www.camelrichard.org

How To Convert Numbers to Decimal on the Command Line:
——————————————-

to convert HEX to decimal:

echo “ibase=16; 38E” | bc

(where ibase is the number base, for HEX, 16 and the number following the ; is the number
you wish to convert)

For Octal, change the ibase to 8, for Binary, change the ibase to 2.

Post a Comment