Jun 9, 2010

Convert ascii text to hex in linux (bash)

If you want to convert your ascii text to hex, fire up the bash-terminal and enter the following command:
$ echo -n 'text' | xxd -ps | sed -e ':a' -e 's/\([0-9]\{2\}\|^\)\([0-9]\{2\}\)/\1\\x\2/;ta'

No comments: