How to remove carriage returns in a text editor?
How can I go about remove carriage returns from a file in a text editor?
For example, if I start with this:
Hello
world
this
is
an
example
I'd like to end up with:
Hello world this is an example
How do I do this in Text Editor and Notepadqq in Ubuntu 16.04 LTS?
This is easy to do in Ubuntu's default text editor gedit a.k.a. Text Editor.
Open Find and Replace menu by using the default Ctrl+H key shortcut or by using the context menu in the top right of gedit.
-
If you are editing a file with UNIX-style line endings, do a find & replace like so:
Find: \n
Replace with: space
-
If you are editing a file with Windows-style line-endings, do a find & replace like so:
Find: \r\n
Replace with: space