Can tr replace one character with two characters?
I am trying to replace \"~\" with \"~\\n\" but the output does not produce the newline.
$ echo \"a
no can do, sorry.
tr is meant to transliterate one character with another.
tr
there are numerous options, but I would use awk, i.e.
awk
echo "asdlksad ~ adlkajsd ~ 12345" | awk '{gsub(/[~]/, "&\n")};1'
output
asdlksad ~ adlkajsd ~ 12345