tr - Removing carriage return and tab escape sequences from string in Bash -


assume have string:

your name is\nbobby\tblahck\r\r 

how can remove characters "\n, \t, \r". string literally looks that, not contain tabs or new lines. characters.

when try

echo "your name is\nbobby\tblahck\r\r" | tr -d '\t' 

tr assumes trying remove tabs, doesn't work , prints examtly same string. ideas how remove them? have same problem sed.

thanks

$ echo "your name is\nbobby\tblahck\r\r" | sed -e 's,\\t|\\r|\\n,,g' name isbobbyblahck 

or

$ echo "your name is\nbobby\tblahck\r\r" | sed -e 's,\\[trn],,g' name isbobbyblahck 

-e on os x; replace -r otherwise.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -