HPE 9000 and HPE e3000 Servers
1748066 Members
5575 Online
108758 Solutions
New Discussion юеВ

Re: convert from hex to decimal

 
SOLVED
Go to solution
System Unix
Frequent Advisor

convert from hex to decimal

Hi,
Can someone please show me the way to convert numbers from hex to decimal and from decimal to hex on 11.23 ( PA-Risc & Itanum ) ?

in 11.11 i used the :

echo '0d25=X' | adb
to convert from base to base.

Thanks

Reuven
Reuven
4 REPLIES 4
Jeff Schussele
Honored Contributor

Re: convert from hex to decimal

Hi Reuven,

This is fairly simple with bc - as follows:

#bc
obase=10
ibase=16
F
15
quit
#

PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Peter Godron
Honored Contributor
Solution

Re: convert from hex to decimal

Reuven
how about:

Decimal to hex:
printf "%x\n" 15
f

Hex to Decimal:
printf "%d\n" 0xf
15
System Unix
Frequent Advisor

Re: convert from hex to decimal

Eventhough I used the way like I presented in my question with adb, Peter Gordon gave me a good sloution and that what counts.

thak you all,
Reuven
Reuven
Dennis Handly
Acclaimed Contributor

Re: convert from hex to decimal

You can also use the shell to do simple conversions:
typeset -i16 x=10#25; echo $x

Going back to your adb solution, you may have to use "adb -o".