Hex to Binary conversion in bash

后端 未结 4 1101
说谎
说谎 2021-02-20 14:08

I\'m trying to convert a series of bytes from hex to bin using bash. but I keep getting (seemingly random) \"(standard_in) 1: syntax error\" replies from the following code:

4条回答
  •  北海茫月
    2021-02-20 14:44

    I came up with this:

    printf converts to hex, xxd -r -p takes the ascii hex stream and makes it actual binary

    dumping with hexdump to prove it worked...

    printf "%016x" 53687091200 | xxd -r -p | hexdump -C
    

提交回复
热议问题