Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • How do I make sed modify newline characters (\x0a)? The command sed -i -e "s/\x0a//g" file does nothing. If I use literally any character other than \x0a it works fine. Commented May 3, 2020 at 2:27
  • try using "s/\n//g" instead (see Reg Expression section in Manpage). if that doesn't work, confirm the hex value (depending on OS, it could be a carriage return instead of a newline) that is in the file. Commented May 6, 2020 at 2:03
  • I figured out the solution is to use sed -z, since this causes sed to delimit lines with null characters instead of newline characters, so the whole file is treated as one massive line and therefore I can make sed edit newline characters. Commented May 7, 2020 at 5:42