Removing newlines (n) with sed

Today I had to search again on how to remove newline special characters with sed. Thanks to Kamil over at, I found it again rather quickly.

Now, this is just for my own safekeeping, so I don’t end up googling for it again … *shrug*

2 thoughts to “Removing newlines (n) with sed”

  1. That’s so ugly though, isn’t it! When I realised it would look like that, I ran looking for another solution. I found one.

    echo -e “Line containing nnewlines!” | tr -d “n”

Leave a Reply

Your email address will not be published. Required fields are marked *

I accept that my given data and my IP address is sent to a server in the USA only for the purpose of spam prevention through the Akismet program.More information on Akismet and GDPR.

This site uses Akismet to reduce spam. Learn how your comment data is processed.