I'm wondering is there's a command or utility already built within the terminal that can take a little endian memory address (for e.g. 5F4A358F) and convert it into a hex code (in this case \x8f\x35\x4a\x5f)?

  • 1
    A tool named xxd is often provided in a vim package. Write a script utilizing that to do your work. – iBug Apr 7 '17 at 13:09
  • @iBug Awesome tip, thanks. Started to do this in awk but I'll look at that also. – Michael A Apr 7 '17 at 13:23
perl -le 'print scalar reverse unpack "h*", pack "H*", "5F4A358F"'

First pack the hex string and then unpack it with 'h', essentially effecting the endianness change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.