Like this:




To this:

A     B     C

D     E     F

G     H     I

It's a 2500 rows file, so i wouldn't just ctrl+j it.

enter image description here

Hit Ctrl+H to access the Replace dialog, tick Regular expression, and enter the above expressions. Here it is in text:

Find what: (.+)\r\n(.+)\r\n(.+)
Replace with: \1\t\2\t\3\t (the last \t is optional; you won't visually notice any difference if you remove it, unless you are expecting the line to end with a tab character)

Replace \r\n in the "Find what:" with:

  • \n if you are editing a file with UNIX-style line endings (linefeed only)
  • \r\n if you are editing a file with Windows-style line endings (carriage return followed by line feed; in this case, you don't need to modify the original regex)
  • \r if you are editing a file with traditional Mac-style line endings (carriage return only)

You can find out which line ending you're using by examining the status bar at the bottom of the Notepad++ window. It will say "Dos\Windows", etc.

If your file has inconsistent line endings (which is a bad thing in general, but not impossible) and you want to replace all possible types of newlines in one go:

Find what: (.+)(\r|\n)+(.+)(\r|\n)+(.+)
Replace with: \1\t\3\t\5\t

You can learn more about regular expressions here.

This will replace all linebreak, not preceeded or followed by another line break, with a tabulation.

  • Ctrl+H
  • Find what: [^\r\n]\K\R(?!\R)
  • Replace with: \t
  • check Wrap around
  • check Regular expression
  • Replace all


[^\r\n]     : not a line break
\K          : forget all we have seen until this position
\R          : any kind of line break
(?!\R)      : negative lookahead, make sure we don'thave a line break after


\t          : a tabulation

Result for given example:

A   B   C

D   E   F

G   H   I

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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