Ask Your Question
0

writer:remove paragraph breaks at end of line containing characters

asked 2019-06-25 15:36:46 +0100

carnish gravatar image

updated 2019-06-25 15:37:15 +0100

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 flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2019-06-25 16:16:40 +0100

RGB-es gravatar image

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).

edit flag offensive delete link more

Comments

(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.

Lupp gravatar imageLupp ( 2019-06-26 11:15:07 +0100 )edit
0

answered 2019-06-26 08:18:10 +0100

gabix gravatar image

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).

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-06-25 15:36:46 +0100

Seen: 71 times

Last updated: Jun 26