Operating System - HP-UX
1826004 Members
3387 Online
109690 Solutions
New Discussion

Need command to convert Hexadecimal kernal parameter value

 
SOLVED
Go to solution
ezhilarasan_1
Occasional Advisor

Need command to convert Hexadecimal kernal parameter value

Hi,

Need command or script to convert Hexadecimal kernal parameter value to Decimal value.
In some servers, kernal parameter values are being set in Hexadecimal. I want to see actual decimal value for semaphores and shared memory parameters setting.

Please help for this.

Thanks
Ezhil

8 REPLIES 8
Patrick Wallek
Honored Contributor
Solution

Re: Need command to convert Hexadecimal kernal parameter value

To convert hex to decimal:

# printf "%#d" 0xfda456

Where 0xfda456 is your hex number.

To convert decimal to hex:

# printf "%#x" 12345
or
# printf "%#X" 12345

The only differrence in the above 2 commands is that the first will use lowercase characters and the 2nd will use upper case characters.
RAC_1
Honored Contributor

Re: Need command to convert Hexadecimal kernal parameter value

Do it as follows.

printf "%d\n" 0x"hex_value"

echo "0Xhex_value=D" | adb

Anil
There is no substitute to HARDWORK
Uday_S_Ankolekar
Honored Contributor

Re: Need command to convert Hexadecimal kernal parameter value

You can use adb.

To convert hex 7F to decimal type:

echo '0x7f=D' | adb

You will receive the following output:

127

and To convert decimal 127 to hex type:

echo '0d127=X' | adb

You will receive the following output:

7F
Good Luck..
Robert-Jan Goossens
Honored Contributor

Re: Need command to convert Hexadecimal kernal parameter value

Hi

example
kernel parameter max_size 0X40000000

remove the 0X

hex to dec
# echo "ibase=16;40000000"|bc
1073741824

dec to hex
# echo "obase=16;1073741824"|bc
40000000

Robert-Jan
H.Merijn Brand (procura
Honored Contributor

Re: Need command to convert Hexadecimal kernal parameter value

I posted kmtune.pl in http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=65781

That would not only convert dec to hex and back but also gives you filtering

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
D Block 2
Respected Contributor

Re: Need command to convert Hexadecimal kernal parameter value

$ bs
ibase 16
10
16
q
$
Golf is a Good Walk Spoiled, Mark Twain.
Bill Hassell
Honored Contributor

Re: Need command to convert Hexadecimal kernal parameter value

If you are using SAM, it always decode the hex (and formula) values to decimal just below the setting line. There is no need to leave any parameter in hex--just type the desired decimal value. The reason some values have a default in hex is lost in antiquity...just use decimal to overwrite the hex value.


Bill Hassell, sysadmin
D Block 2
Respected Contributor

Re: Need command to convert Hexadecimal kernal parameter value

Yes, I agree with Bill herein, you can change this using sam via x-windows version.
Golf is a Good Walk Spoiled, Mark Twain.