Operating System - HP-UX
1834612 Members
3503 Online
110069 Solutions
New Discussion

Re: Hex calculator in HPUX

 
SOLVED
Go to solution
Jacob D Levin
Frequent Advisor

Hex calculator in HPUX

Hi, is there any Hex calculators built into HPUX that are user-friendly? I'm trying to build a script to get kernel parm values and convert the hex into numeric from within the script without having to build my own.
thanks

Jake
just hit enter, what could it hurt?
5 REPLIES 5
Sundar_7
Honored Contributor
Solution

Re: Hex calculator in HPUX

Hi Jake,

Sure, adb can do it for you. adb can convert HEX to DEC and viceversa

# echo "0X=D" | adb

This will convert the HEX input to decimal

# echo "0D=X" | adb

This will convert the DEC input to HEX.

- Sundar.
Learn What to do ,How to do and more importantly When to do ?
Sanjay_6
Honored Contributor

Re: Hex calculator in HPUX

Hi Jake,

Did you take a look at the "bc" command. This is the binary calculator.

Some of the kernel parameters are defined as some other kernel parameter + some value. How are you planning to address through a script.

Hope this helps.

Regds
H.Merijn Brand (procura
Honored Contributor

Re: Hex calculator in HPUX

Have you ever tried my kmtune.pl?

Attached.

Enjoy, Have FUN! H.Merijn [ who also has a caculator written in c, but if it's user-friendly is just a matter of taste. For me it is, I used it daily ]
Enjoy, Have FUN! H.Merijn
Jacob D Levin
Frequent Advisor

Re: Hex calculator in HPUX

Great everyone I appreciate all the replies, Sundar those commands work great. Sanjay, we are only looking at the SHMMAX paramter right now since we got bit last week with one system not being set properly and as far as I can tell it's either numeric or hex so we're okay for now. Procura, I've downloaded your perl script onto one of my systems and I'm gonna take a look at it. maybe I won't have to duplicate your work!

Thanks everyone!
just hit enter, what could it hurt?
Bill Hassell
Honored Contributor

Re: Hex calculator in HPUX

One thing to note about SAM: enter a kernel value in hex (0x1234) and the decimal value will appear at the bottom right of the screen. bc will give you a hex converter:

$ MYNUM=1F
$ echo "ibase=16\n$MYNUM" | bc"
$ 31

bc requires hex values to be UPPERCASE. NOTE: SAM does *not* require hex so you can just type in the decimal number. The 0x flag says the value is in hex but leave out 0x and now the number is taken as decimal. Now, if SAM could just understand those nifty units of measure like dd (900k) so counting zeros wasn't such a problem...


Bill Hassell, sysadmin