Reverse hexdump without xxd

The "hexdump" command cannot perform reverse operation. On the other hand, the "xxd" command with -r option performs reverse hexdump, while the "xxd" command without -r performs the (forward) hexdump. An example of hexdump is to convert ABCD into 41 42 43 44. An example of reverse hexdump is to convert 41 42 43 44 back into ABCD.

The command "xxd" comes with Mac OS X. However, Linux may not come with "xxd". On a Linux that does not come with "xxd", how can reverse hexdump be achieved? Perhaps, vi editor?

Thanks in advance.

xxd is available on most linux distros, it just may not be installed on yours, for whatever reason. It is definitely part of the standard install AFAIK.
try

find / -type f -name xxd

xxd(1): make hexdump/do reverse - Linux man page

Duplicating what it does is not simple, IMO, because it requires a parser, endian understanding, etc. You are far better off finding it on your box, or installing it.

Assuming the values are space-delimited single bytes in hex:

$ cat hdump
41 42 43 44
45 46 47 48

echo 'ibase=16' | cat - hdump | tr ' ' \; | bc | awk '{printf("%c",$0)}'
ABCDEFGH

Regards,
Alister

xxd is part of VIm. On OpenSuSE 10.3

> rpm -qf $(which xxd)
vim-base-7.1-44.2

So unless you're on an emacs/nano only system, you should have access to it. Note that *Ubuntu and Gentoo by default only ship nano, so you'll have to install VIm yourself.