I\'m now doing it this way:
[root@~]# echo Aa|hexdump -v 0000000 6141 000a 0000003 [root@~]# echo -e \"\\x41\\x41\\x41\\x41\" A
For single line solution:
echo "Hello World" | xxd -ps -c 200 | tr -d '\n'
It will print:
48656c6c6f20576f726c640a
or for files:
cat /path/to/file | xxd -ps -c 200 | tr -d '\n'
For reverse operation:
echo '48656c6c6f20576f726c640a' | xxd -ps -r
Hello World