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
tr can only do 1 to 1 translation.
tr
Here is one way of doing that using pure Bash:
s='"asdlksad ~ adlkajsd ~ 12345' r=$'~\n' echo -e "${s//\~/$r}" asdlksad ~ adlkajsd ~ 12345