111

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.
152
  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

  • Thanks but i has to be done one by one, is there a way to do this for the entire document? – Gabriel Dec 12 '12 at 9:28
  • 2
    I get it now, I selected the entire document and works exactly like I needed! – Gabriel Dec 12 '12 at 9:29
  • 6
    CTRL J is the shortcut – user640378 Jan 15 '14 at 15:46
  • Tip: You might need to hit CTRL + J more than once. Do not use >View >Word wrap, to better see the linebreaks. – Kai Noack Nov 29 '16 at 11:54
  • 4
    how can I disable adding spaces? – Keith Tyler Mar 7 '17 at 21:17
41

CTRL+H

In Search Mode pick Extended

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

  • 4
    I believe it needs to be \r\n since this is for Windows. – James P Dec 12 '12 at 9:25
  • 2
    It should be \r\n and the replace field should contain one space character. – amiregelz Dec 12 '12 at 9:29
  • @JamesP, what is the difference? And why so in Windows? – user1993 Jun 25 '17 at 8:16
  • 2
    @user1993: The Wikipedia article en.wikipedia.org/wiki/Newline has detailed information about how linebreaks work on different operating systems. – James P Jun 29 '17 at 8:53
2

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.

  • Did you mean \n – Prasanna Aug 28 '15 at 5:59
  • No, I mean \r. \n does nothing on my system. – Alan M Aug 31 '15 at 22:53

protected by Community Aug 11 at 20:26

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.