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

Answer by anubhava for Replace newlines with literal \n

$
0
0

This should work with both LF or CR-LF line endings:

sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' file

Viewing all articles
Browse latest Browse all 8

Trending Articles



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