To use a single command in converting from binary to ascii hex

1.9k views Asked by At

I am converting binary data into hex and viewing this hex data in head from a continuous stream. I run the following where the conversion is from here

echo "ibase=2;obase=10000;$(echo `sed '1q;d' /Users/masi/Dropbox/123/r3.raw`)" \ 
                                                                               \ 
| bc                                                                           \
                                                                               \  
| head

and I get

(standard_in) 1: illegal character: H

so wrong datatype.

How can you do the conversion form binary to binary ascii by a single command efficietly?

1

There are 1 answers

0
Léo Léopold Hertz 준영 On BEST ANSWER

I run the following code based on Wintermute's comment

hexdump -e '/4 "%08x\n"' r3.raw 

For instance, head r3.raw | hexdump -e '/4 "%08x\n" gives

ffffffff
555eea57
...