# writer:remove paragraph breaks at end of line containing characters

I have a large plain text file imported to writer. The original file has paragraph breaks at the end of each line of text and then two paragraph breaks between paragraphs.

I can remove the end-of-line breaks using search/replace with '$' but if I apply this to the entire document, I end up with one long line. I can work through piecemeal by applying the replacement to only the selected paragraph and though an acceptable solution it is not ideal. So I think I want a real expression that matches paragraph break at end of line only if that line contains characters that are not paragraph breaks and to replace only the paragraph break. edit retag close merge delete ## 2 Answers Sort by » oldest newest most voted I don't think this is possible with the build-in RegExp engine: if you search for "something+paragraph break" there is no way to select just the paragraph break, not even with a "Look-behind assertion" or any other RegExp black magic. You may try with the AltSearch extension, which is more powerful. Or use a three step approach: first search for the empty paragraphs (with ^$) and replace them with some tag, then eliminate all paragraph ends (search for \$ and replace with a space or nothing, you'll end up with just one big paragraph in the document) and finally replace the tag you entered before with a paragraph break (search for your tag and replace with \n ---yes, you need to write paragraph breaks differently on the search and on the replace boxes).

more

(I don't know the tool @gabix recommended. It may be great.)
For "dozens of versions" now the installable extension AltSearch works perfectly for me in all the related cases.

( 2019-06-26 11:15:07 +0200 )edit

A solution: OOoFBTools. Menu OOoFBTools → Join broken lines of a paragraph (for automatic processing of the entire text) or Process ends of lines/paragraphs (for manual processing of a selection).

more