Subject: printf(1) argument doesn't accept hexadecimal
To: None <netbsd-help@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 07/20/2001 12:32:57
I wanted to convert the decimal number from a hexadecimal using printf.
$ printf "%d\n" 0xC0
bash: printf: 0xC0: illegal number
$ printf "%x\n" 192
c0
$ perl -e 'printf "%d\n",0xC0'
192
Can printf(1) use non-decimal for argument?
If not, any ideas on how to make /usr/bin/printf support non-decimal
numbers for an argument?
Or any suggestions for a tool that already does this hexadecimal to
decimal conversion?
Thanks,
Jeremy C. Reed
http://www.reedmedia.net/