[Solved] How to delete line breaks with global command?
[Solved] How to delete line breaks with global command?
Please answer the following questions, along with describing your problem or question.
Which version of OpenOffice.org are you using:
What Operating System (version) are you using:
----------------------------------------------------------------------------------
Your question: Is there a global command that will remove all linebreaks from a file in Open Office 2.3.1? And how would I replace all double linebreaks with paragragh breaks? Previously I have just gone back to Word, where it's obvious and easy, but there must be a way in OpenOffice.
Which version of OpenOffice.org are you using:
What Operating System (version) are you using:
----------------------------------------------------------------------------------
Your question: Is there a global command that will remove all linebreaks from a file in Open Office 2.3.1? And how would I replace all double linebreaks with paragragh breaks? Previously I have just gone back to Word, where it's obvious and easy, but there must be a way in OpenOffice.
Last edited by Hagar Delest on Wed Jun 11, 2008 11:23 pm, edited 2 times in total.
Reason: tagged the thread as Solved.
Reason: tagged the thread as Solved.
Re: How to delete line breaks with global command?
Edit > Find & Replace
Search for: \n
Replace with: a space
Options > Regular expressions = YES
That will replace all line breaks with a space.
For "double linebreaks" to paragraph, use:
Search for: \n\n
Replace with: \n
Options > Regular expressions = YES
Yes, that makes no sense at all, but it works.
Obviously, you have to process the "double linebreaks" before you do the others.
Search for: \n
Replace with: a space
Options > Regular expressions = YES
That will replace all line breaks with a space.
For "double linebreaks" to paragraph, use:
Search for: \n\n
Replace with: \n
Options > Regular expressions = YES
Yes, that makes no sense at all, but it works.
Obviously, you have to process the "double linebreaks" before you do the others.
AOO4/LO5 • Linux • Fedora 23
Re: How to delete line breaks with global command?
Many thanks for the quick response. I would never have thought to check the regular expressions box! Is this something that most people would understand? Also, could someone say if expressions for linebreak etc are given somewhere? I did look, but couldn't find anything relevant.
Re: How to delete line breaks with global command?
No--that's why it's tucked away under the "Options" view.Is this something that most people would understand?
Regular expressions are more powerful (in some ways) than Word's wildcards but also more difficult to use. There is a full list of the pattern items in the online help, under "Regular Expressions".
You can also take a look at this article: Regular Expressions in Writer [OOo wiki]
AOO4/LO5 • Linux • Fedora 23
Re: How to delete line breaks with global command?
Regular expressions have been around some 20 years in advanced text editors and programming languages.
A dot means "any item" like ? in shell patterns. The asterisc * means "zero or more of the preceeding item". Thus .* means "zero or more of any item" like * in shell patterns.
Short hand tutorial for those missing simple * and ?
- Use .* instead of *
- Use . instead of ?
- ^ means start of paragraph
- $ means end of paragraph
- if you search for a literal * escape it with \*
- same with any kind of braces and any of ^$.*?\&|
- in doubt escape anything but <, > and alphanumerics, since \<, \>, \n, \t and \C have a special meaning in regexes.
Some examples derived from the above set of rules:
A dot means "any item" like ? in shell patterns. The asterisc * means "zero or more of the preceeding item". Thus .* means "zero or more of any item" like * in shell patterns.
Short hand tutorial for those missing simple * and ?
- Use .* instead of *
- Use . instead of ?
- ^ means start of paragraph
- $ means end of paragraph
- if you search for a literal * escape it with \*
- same with any kind of braces and any of ^$.*?\&|
- in doubt escape anything but <, > and alphanumerics, since \<, \>, \n, \t and \C have a special meaning in regexes.
Some examples derived from the above set of rules:
Code: Select all
Shell pattern Regex Remark
*x* x Contains x
*x*y* x.*y Contains x and y
x* ^x Starts with x
*x x$ Ends with x
x? x. x followed by one of any
x. x\. x followed by dot
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 6
- Joined: Thu Jun 16, 2011 12:35 am
Re: [Solved] How to delete line breaks with global command?
Hi,
Sorry for digging up this thread, but this does not work for me.using OO 3.3.0 on XP. I followed te instructions to the lletteer but OO would just search the whole document, without result, while I can clearly see the \n\n\n. I try with \n\n (one linebreak less) and no luck either.
Sorry for digging up this thread, but this does not work for me.using OO 3.3.0 on XP. I followed te instructions to the lletteer but OO would just search the whole document, without result, while I can clearly see the \n\n\n. I try with \n\n (one linebreak less) and no luck either.
OpenOffice 3.3.0 on Windows XP
- Hagar Delest
- Moderator
- Posts: 32667
- Joined: Sun Oct 07, 2007 9:07 pm
- Location: France
Re: [Solved] How to delete line breaks with global command?
You might try the AltSearch extension for that.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Re: [Solved] How to delete line breaks with global command?
You need to drop the More Options arrow and tick regular expressions. But AltSearch extension is the way to go.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
-
- Posts: 6
- Joined: Thu Jun 16, 2011 12:35 am
Re: [Solved] How to delete line breaks with global command?
Thanks, but I already ticked that option, thay's why I was so surprised my expression didn't work. I'll try the altsearch extension, thanks!RoryOF wrote:You need to drop the More Options arrow and tick regular expressions. But AltSearch extension is the way to go.
OpenOffice 3.3.0 on Windows XP
Re: [Solved] How to delete line breaks with global command?
The regular Find and Replace is limited, as far as I remember, by OOo's 64K character limit for paragraphs. AltSearch is not, because of the language in which it is written.
Edit: Also, I think the \n in Find only matches Ctrl Enter = you may have to use $ or some combination of $ and ^$. I always have to work it out when I need it. |
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: [Solved] How to delete line breaks with global command?
Thank you, Thank you, Thank you. I have been looking for this solution for several years now.
Don't compromise yourself. You're all you've got. Janis Joplin
OpenOffice.org 3.3.0 OOO330m20(Build:9567)
Windows 7 Service Pack 1
OpenOffice.org 3.3.0 OOO330m20(Build:9567)
Windows 7 Service Pack 1