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

Latest Images

Trending Articles



Latest Images