From: "Stephane Tsacas"
<stephane.tsacas(a)gmail.com>
I guess you have hex digit as input, not prefixed by 0x (if they are,
remove the string "0x" from the x= statement. Maybe that code might
help :
awk --non-decimal-data 'BEGIN {RS=" ";} {x="0x"$0;
s=""; while (x > 0)
{ s=and(x,1)""s; x=rshift(x,1); } print s}'
0 1 2 3 4 5 6 7 8 9 a b c d e f as input will print :
0
1
10
11
100
101
110
111
1000
1001
1010
1011
1100
1101
1110
1111
you can put your own code after the x= statement I guess.
Stephane
---snip---
Hi
I'm not sure this is what he is looking for. I think
he wants the hex number converted to a byte value
not just printed in ascii as a binary value.
Dwight