158

Is there a simple way of removing linebreaks in Notepad++?

For example:

This text has been splitted
in lines, and it's longer than
3200 words, so it would be great
to find and replace line breaks
like these.
Stevoisiak
  • 14,394
  • 40
  • 103
  • 163
Gabriel
  • 2,920
  • 2
    Hmm, in VI it would be just typing 4J – Bernhard Dec 12 '12 at 09:11
  • If you are looking to compose something like a URL from putting the URI parameters on multiple lines, then this answer is a bit more helpful: http://stackoverflow.com/a/13990281/501113 – chaotic3quilibrium Aug 19 '15 at 15:37
  • Do you expect spaces added: "This text has been splitted in lines, and it's longer than 3200 words..." or no spaces added: "This text has been splittedin lines, and it's longer than3200 words..." Each result requires a different technique. – ndemarco Nov 05 '21 at 14:17

3 Answers3

230
  1. Highlight the lines you want to join (or use Ctrl + A to select everything)
  2. Choose Edit → Line Operations → Join Lines from the menu or press Ctrl + J.

It will put in spaces automatically if necessary to prevent words from getting stuck together

James P
  • 11,333
59

CTRL+H

In Search Mode pick Extended

Find - \r\n Replace - leave it empty.

Ofiris
  • 1,927
4

For me, using Win 7, I had to use

\r

in the Find box and type in <space> in the Replace box so that there is a single space between the last word of the current line and the first word of the next line.

Alan M
  • 183