When I do
select * .. | mysql ... > /tmp/file from a table with text, there are some problematic characters that prevent me from loading it to a different db using
copy (postgres) or
load into (mysql).
Character like tab, new line are translated automatically to
\t, but some of the problematic characters are escape
^H and maybe other that I haven't seen before.
Usually I would just replace it like
echo "select * .." | mysql .. | sed 's/\r/\\r/g', but there are too many unknown chars there. So instead of replacing them after the select I would like a function that retrieve the text already escaped (I guess remove them is also fine).
How should I do it?