How can I replace each newline (\n) with a space using sed?

How can I replace a newline (“\n“) with a space (““) using the sed command?

I unsuccessfully tried:

sed 's#\n# #g' file
sed 's#^$# #g' file

How do I fix it?

4
43

Leave a Comment