I'm pulling some data from a database and one of the strings I'm getting back is in one line and contains multiple instances of the string \n
. These are not newline characters; they are literally the string \n
, i.e. backslash+en, or hex 5C 6E.
I've tried using sed and tr to remove them however they don't seem recognize the string and don't effect the variable at all. This has been a difficult problem to search for on google as all the results I get back are about how to remove newline characters from strings which is not what I need.
How can I remove these strings from my variable in bash?
Example data:
\n\nCreate a URL where the client can point their web browser to. This URL should test the following IP addresses and ports for connectivity.
Example failed command:
echo "$someString" | tr '\\n' ''
Operating system: Solaris 10
Possible Duplicate - Except this is in python
echo "one\\ntwo" | perl -wpe 's/\\n//g'
. (The\\n
in input is to create such a string.) – Perl