Quantcast
Channel: Replace newlines with literal \n - Stack Overflow
Viewing all articles
Browse latest Browse all 8

Answer by RSX for Replace newlines with literal \n

$
0
0

In case it helps anyone, I was searching for the opposite of this question: to replace literal '\'n in a string with newline. I managed to solve it with sed like this:

_s="foo\nbar\n"echo $_s | sed 's/\\n/\n/g'

Viewing all articles
Browse latest Browse all 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>