I have a bash script that checks database for changes and emails me these changes. Works nice, until it tries to send something non-printable, which 'breaks' the mail.
Is there any handy way how to replace all non-printable characters from a string with their hexadecimal code (something like "abc<1A>def<07>xyz")?
All I can think of is a looong chain of
sed commands handing single character each. Which doesn't seem right.
edit: After posting this question, I found
cat -v command doing mostly what I wanted. Using this for now, unless someone points something better.