107

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.
148
  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
  • OMG, thanks a lot... didnt knew about that - would have saved me a lot of time ;) – Sagive SEO Jun 29 '15 at 11:37
  • 4
    how can I disable adding spaces? – Keith Tyler Mar 7 '17 at 21:17
42

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
-2

If removing newlines is your only aim and your text contains only letters, simply copy and paste your text on a browser's (chrome for example) search bar. Then copy the text in the search bar and paste it in your desired file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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