Hexdump reverse command

前端 未结 4 583
悲哀的现实
悲哀的现实 2021-02-08 14:54

The hexdump command converts any file to hex values.

But what if I have hex values and I want to reverse the process, is this possible?

4条回答
  •  攒了一身酷
    2021-02-08 15:30

    If you have only a hexdump generated with hexdump you can use the following command

    sed -E 's/ /: /;s/ (..)(..)/ \2\1/g;$d' dump | xxd -r
    

    The sed part converts hexdump's format into xxd's format, at least so far that xxd -r works.

    Known Bugs (see comment section)

    • A trailing null byte is added if the original file was of odd length (e.g. 1, 3, 5, 7, ..., byte long).
    • Repeating sections of the original file are not restored correctly if they were hexdumped using a *.

提交回复
热议问题