How to merge text into one document without extra line breaks

How to merge text into one document without extra line breaks

Notes copied from several files, chat exports, or PDF pages rarely join cleanly. Stack the pieces with one separator, then collapse the blank lines and broken lines that came along with them.

Pasted text brings its line breaks with it

Copy a few paragraphs from a PDF and each line of the page arrives as its own line, broken in the middle of a sentence. Copy from a chat or an email and you get runs of three or four blank lines. Paste five such pieces one under another and the result is hard to read and harder to edit.

Cleaning that by hand means deleting line breaks one at a time and missing a few. In a long document it takes most of an afternoon.

Join with the Text Merger, clean up with Find and Replace

The Text Merger takes two or more text boxes and, in Concatenate mode, joins them one after another with the separator you choose between each part. The Separator box holds real line breaks, so pressing Enter twice in it leaves exactly one blank line between parts. Line by line mode does something else: it pairs line 1 of each input, then line 2, which suits lists that belong in columns. It handles up to 10 MB of text.

Then paste the merged text into Find and Replace and add regex rules. Rules run from top to bottom, and the page previews how many matches each one has before you apply them. Patterns that match empty text are refused. Both tools run in your browser.

Merge text into one document

  1. Paste each piece into its own box in the Text Merger, in the order you want.
  2. Choose Concatenate, clear the Separator box, and press Enter twice in it.
  3. Copy the merged result into Find and Replace.
  4. Add a regex rule that finds (\n\n)\n+ and replaces it with $1. Three or more line breaks in a row become a single blank line.
  5. To rejoin lines broken mid-sentence, add a second regex rule that finds ([^\n])\n(?=[^\n]) and replaces it with $1 followed by one space. Single line breaks become spaces, and blank lines between paragraphs stay.
  6. Check the match preview, apply the rules, and copy or download the result.

What the merge and clean-up won't fix

  • Line by line mode matches lines by position only, not by content.
  • The second rule also joins lines that were meant to stay apart, such as list items or lines of an address. Run it only on prose.
  • Rules run in order, so a later rule works on the text the earlier one produced.
  • Find and Replace treats HTML as plain text. Strip the markup first if you merged web pages.

Frequently asked questions

How do I merge several text files into one?

Paste each file's text into its own box in the Text Merger, choose Concatenate, type the separator you want between the parts, and copy or download the result.

How do I remove extra blank lines from text?

In Find and Replace, add a regex rule that finds (\n\n)\n+ and replaces it with $1. Runs of blank lines shrink to one.

Why does text copied from a PDF break in the middle of sentences?

The copy keeps the line breaks of the printed page. A regex rule that turns single line breaks into spaces rejoins the sentences.

Can I merge two lists into columns instead?

Yes. Use the Text Merger's Line by line mode. Line 1 of each list becomes row 1, line 2 becomes row 2, and so on.

Tools used in this guide

  • Text MergerText Tools

    Joins multiple text blocks with a separator or merges them line by line.

  • Find and ReplaceText Tools

    Applies plain-text or regex replacement rules and reports how many matches each rule changed.

More from the blog

All guides