- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Decimal to Hex conversion
Operating System - HP-UX
1753782
Members
7164
Online
108799
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-1999 03:19 AM
тАО10-28-1999 03:19 AM
Decimal to Hex conversion
I have a need to convert Decimal to Hex inside of a korn shell script. Any
suggestions would be appreciated.
Thanks,
Gary
suggestions would be appreciated.
Thanks,
Gary
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-1999 05:57 AM
тАО10-28-1999 05:57 AM
Re: Decimal to Hex conversion
You can use adb(1) to convert decimal to hexadecimal and
hexadecimal to decimal as follows:- To convert decimal 127 to hex type:
echo '0d127=X' | adb
You will receive the following output: 7F
- To convert hex 7F to decimal type:
echo '0x7f=D' | adb
You will receive the following output: 127
hexadecimal to decimal as follows:- To convert decimal 127 to hex type:
echo '0d127=X' | adb
You will receive the following output: 7F
- To convert hex 7F to decimal type:
echo '0x7f=D' | adb
You will receive the following output: 127
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-1999 01:15 PM
тАО10-28-1999 01:15 PM
Re: Decimal to Hex conversion
This works too. For example to convert 31 to Hex
$printf "%x\n" 31
$1f
$printf "%x\n" 31
$1f
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-1999 10:13 PM
тАО11-03-1999 10:13 PM
Re: Decimal to Hex conversion
Try:
#!/usr/bin/ksh
num=$1
typeset -i16 num
print $num # with the base
print ${num#16\#} # without the leading 16#
regards
Ged
PS nice one Saleem
#!/usr/bin/ksh
num=$1
typeset -i16 num
print $num # with the base
print ${num#16\#} # without the leading 16#
regards
Ged
PS nice one Saleem
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP