Newsgroups: comp.unix.shell Date: 1995/09/14
|> I want to convert a hex number to the character value. In C I can do the following |> |> |> printf("%c\n", 0x21);
You can use the desk calculator /bin/dc:
Num=21 echo "16i${Num}P" | dc
Explaination of commands:
dc uses postfix (reverse Polish) notation. The command string is interpreted as:
Praveen Puri
Newsgroups: comp.unix.questions Date: 1995/11/16
|> Is there any tools in unix that can do HEX --> Decimal (and the |> reverse) conversions...
dec to hex
lucio 291 > bc ibase=10 obase=16 10 A <-- indicates computer reply 11 B <-- 16 10 <-- ctl-D
hex to dec
lucio 295 > bc ibase=16 do NOT specify obase !! 0A 10 <-- 0B 11 <-- 10 16 <-- FF 255 <--
Lucio Chiappetti