Page 1 of 1
[Solved] How to delete line breaks with global command?
Posted: Mon Feb 11, 2008 7:02 pm
by kirker
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.
Re: How to delete line breaks with global command?
Posted: Mon Feb 11, 2008 7:24 pm
by acknak
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.
Re: How to delete line breaks with global command?
Posted: Mon Feb 11, 2008 8:35 pm
by kirker
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?
Posted: Mon Feb 11, 2008 9:13 pm
by acknak
Is this something that most people would understand?
No--that's why it's tucked away under the "Options" view.
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]
Re: How to delete line breaks with global command?
Posted: Mon Feb 11, 2008 9:41 pm
by Villeroy
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:
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
Re: [Solved] How to delete line breaks with global command?
Posted: Thu Jun 16, 2011 12:42 am
by dutchmarco
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.
Re: [Solved] How to delete line breaks with global command?
Posted: Thu Jun 16, 2011 8:15 am
by Hagar Delest
You might try the
AltSearch extension for that.
Re: [Solved] How to delete line breaks with global command?
Posted: Thu Jun 16, 2011 8:35 am
by RoryOF
You need to drop the More Options arrow and tick regular expressions. But AltSearch extension is the way to go.
Re: [Solved] How to delete line breaks with global command?
Posted: Fri Jun 17, 2011 9:40 am
by dutchmarco
RoryOF wrote:You need to drop the More Options arrow and tick regular expressions. But AltSearch extension is the way to go.
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!
Re: [Solved] How to delete line breaks with global command?
Posted: Fri Jun 17, 2011 10:01 am
by RoryOF
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. |
Re: [Solved] How to delete line breaks with global command?
Posted: Sun Jun 03, 2012 4:39 pm
by colepjc
Thank you, Thank you, Thank you. I have been looking for this solution for several years now.