I am looking for some easy way in shell script for converting hex number into sequence of 0 and 1 characters.
Example:
5F -> "01011111"
Is there any command or easy method for accomplish it or should I write some switch for it?
echo "ibase=16; obase=2; 5F" | bc
I used 'bc' command in Linux. (much more complex calculator than converting!)
echo 'ibase=16;obase=2;5f' | bc
ibase parameter is the input base (hexa in this case), and obase the output base (binary).
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With