I\'m hacking around in some scripts trying to parse some data written by Javas DataOutputStream#writeLong(...). Since java always seems to write big endian, I have
DataOutputStream#writeLong(...)
BASH:
od -b -v -w8 | while read pfx b8 ; do [ "$b8" ] && echo -n 12345678 | tr 87654321 \\${b8// /\\} ; done
To be a bit more robust depending on the output style of od, it may need to compress spaces ( insert "| sed 's/ */ /g'" after the w8).
od
"| sed 's/ */ /g'"
w8