Skip to content

Instantly share code, notes, and snippets.

@rohan-molloy
Created April 17, 2020 06:47
Show Gist options
  • Save rohan-molloy/0b8c64856e31b35476c8edde206fa868 to your computer and use it in GitHub Desktop.
Save rohan-molloy/0b8c64856e31b35476c8edde206fa868 to your computer and use it in GitHub Desktop.

Replace newline with a literal "\n"

sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment