od -An -vtx1 -w1 test.txt | cut -c2-
If you don't want newlines:
od -An -vtx1 -w1 test.txt | cut -c2- | fgrep -v 0a
Meaning of od
options:
-An
: addresses: no-v
: verbose, i.e., don't write a*
instead of repeating lines-tx1
: output type: hex, 1 byte (use-tx1z
for anhd
-like output)-w1
: max width: 1
One nice thing about od
is that it's available on any *x
system.