From The Document Foundation Wiki
How do I eliminate the numerous line breaks that appear in text pasted into a document (for example text from an email)?
You need to use a regular expression:
- select ▸ menu;
- at the bottom left of the dialog box, click the More Options button;
- check Regular expressions;
- in the Find field, enter:
$to find the end-of-paragraph characters,
^$to find the empty paragraphs (this paragraph mark
¶at the start of paragraph = means an empty paragraph);
- click the Find button;
- to replace the line-break by an empty space, enter a space in the Replace with field, then click the Replace;
- to replace the line-break by nothing (only delete the character), click the Replace button (without entering anything in the Replace with field); and
- if you have a lot of line breaks to replace, you can also use the Replace all button. You are recommended to save your document before using this option, as it may lead to unexpected consequences.
- for line-breaks (created by the ⇧ Shift+↵ Enter keys):
- for tabs :
For more information on regular expressions search the help files for "Regular Expressions"