Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

  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 (help.libreoffice.org/Common/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. –  broiyan 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
add comment

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
1  
This answer does not address the question. –  broiyan Aug 29 '12 at 15:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.