awk, how to convert hex to decimal
Greg Strockbine
gregs at well.sf.ca.us
Tue Feb 5 12:58:47 AEST 1991
How do I convert a hex number (or is it string) into decimal?
Here is the problem, I take a snap shot of a hex dump from a debugger,
use sed to extract the line I'm interested in, then pass it to awk.
So I've got this field 930A and use the awk substr to break this into
2 fields, a=93 and b=0A. So that's 2 hex numbers represented as strings
but I want to print the 93 out as a decimal number and I want to use the
0A as an index into an array of messages so I can print out a corresponding
message.
Can I use an associative array for the messages and say something like:
usr_msg = messages[0A]?
How do I convert the 93 to decimal?
Thanks in advance.
More information about the Comp.unix.shell
mailing list