Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Often I find that I copy text from a gedit (linux) text editor document into a word processor like LibreOffice Writer. Of course I have hard linebreaks coded into the text.

How can I do a search and replace to reflow the text in LibreOffice Writer? In other words, I need the linebreaks removed.

Edit: Since it was suggested, I will add that I did tick regular expressions and being an old programmer I did use \n just in case it has any meaning for LibreOffice. The search key was not found when I opted for the find-and-replace.

share|improve this question
May I ask what LibreOffice version do you use? With version 4.0 I also got the error "search key not found" where it is working with version 3.6. – nixda Aug 10 '13 at 8:15
AutoCorrect has a setting that will remove the new lines that I paste in from Emacs (they become paragraph breaks in Writer): – Qsigma Oct 5 '15 at 19:29
  1. In the Edit > Find and Replace dialog, tick "Use regular expressions", put "\n" in the 'search for' box, nothing in the replace with box, click Replace all. This removes line breaks that you can insert with Shift+Enter (manual line breaks). Here's a link to LibreOffice documentation on regular expressions.
  2. LibreOffice Writer can't replace paragraph breaks by default. Use the AltSearch add-on for OpenOffice, as it also works with LibreOffice.
  3. To do the paste-and-remove-linebreaks automatically, you can try recording a macro (, just paste and perform the replace and have LibreOffice record them in a macro.
share|improve this answer
I did think of using \n and I get "search key not found" when I search for \n. – H2ONaCl Aug 29 '12 at 8:54
This means you have no line breaks in the document. Use (2) to replace paragraph breaks. – user89272 Aug 31 '12 at 4:10

No, actually not! Line break codes you used in gEdit is not used by LibreOffice to break lines. LibreOffice pastes line break codes as it is.

share|improve this answer
This answer does not address the question. – H2ONaCl Aug 29 '12 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .