I'm doing a migration from mysql to postgres. As part of that I'm processing the mysql dump using sed before loading that into postgres.
My MySQL dump has some \0
characters and postgres doesn't like them. So I'm replacing them using a space.
sed 's/\\0/ /g' $dumpfile
Noticed an issue when the line has 320.48k\\02. Easy Listening
.
$ echo '320.48k\\02. Easy Listening' | sed 's/\\0/ /g'
320.48k\ 2. Easy Listening
Thats not what I quite wanted. \\
characters are followed by 0
is not a null character. and I want to keep as it is.
Any sed experts around to help?
If you want to replace null characters (\0), you can use:
sed 's/\x0/ /g'
or
tr '\0' ' '
I use a lot
tr '\0' '\n'< /proc/13217/environ
to display environment of a process
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With