How do I find and replace hidden paragraph marks?
-
- Posts: 2
- Joined: Tue Aug 05, 2008 7:15 pm
How do I find and replace hidden paragraph marks?
Here is my problem:
I have composed my document in Google Docs and now I need to format it in Open Office.
It was my habit to compose in single space but slap an empty line space between paragraphs.
Now I need the document to be evenly double spaced so that there are NO extra spaces between paragraphs.
In MS Word this is done by "finding" two hard paragraph codes in a row and then "replacing" with a single hard paragraph code and a TAB.
That is what I want to do with my Open Office doc. How can I do this?
Thanks so much.
-- Andy
I have composed my document in Google Docs and now I need to format it in Open Office.
It was my habit to compose in single space but slap an empty line space between paragraphs.
Now I need the document to be evenly double spaced so that there are NO extra spaces between paragraphs.
In MS Word this is done by "finding" two hard paragraph codes in a row and then "replacing" with a single hard paragraph code and a TAB.
That is what I want to do with my Open Office doc. How can I do this?
Thanks so much.
-- Andy
OOo 2.4.X on Ubuntu 8.x
Re: How do I find and replace hidden paragraph marks?
You can't search across a paragraph boundary in OOo, so your strategy won't work in Writer.
You can search for and remove completely empty paragraphs, like this:
Search for: ^$
Replace with: (empty)
Options/Regular expressions: YES (checked)
If the paragraphs have anything in them, even spaces or tabs, this won't match. In that case, you have to delete them by hand.
Also, you can put text in the "Replace with:" box, but you'll find it next to impossible to put a tab in there.
You can search for and remove completely empty paragraphs, like this:
Search for: ^$
Replace with: (empty)
Options/Regular expressions: YES (checked)
If the paragraphs have anything in them, even spaces or tabs, this won't match. In that case, you have to delete them by hand.
Also, you can put text in the "Replace with:" box, but you'll find it next to impossible to put a tab in there.
AOO4/LO5 • Linux • Fedora 23
-
- Posts: 2
- Joined: Tue Aug 05, 2008 7:15 pm
Re: How do I find and replace hidden paragraph marks?
The document I am working with is hundreds of pages long.
Can you think of any other way to get an evenly formatted double spaced document out of my text without doing it all by hand?
Can you think of any other way to get an evenly formatted double spaced document out of my text without doing it all by hand?
OOo 2.4.X on Ubuntu 8.x
Re: How do I find and replace hidden paragraph marks?
This is one reason why Google Docs isn't nearly up to snuff yet. It forces you to create spacing between paragraphs by hitting the Enter key. Its style definition should have two kinds of spacing: between lines (which it currently has) and between paragraphs. Unfortunately, it doesn't, and unfortunately, the document wasn't originally written in OOo where you could have made one change to the paragraph style, to change all that spacing.iamtherealandy wrote:The document I am working with is hundreds of pages long.
Can you think of any other way to get an evenly formatted double spaced document out of my text without doing it all by hand?
Here is a very good reference on using regular expressions for find and replace:
http://wiki.services.openoffice.org/wik ... _in_Writer
Cheers!
---Fox
OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
---Fox
OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
Re: How do I find and replace hidden paragraph marks?
I can think of lots of ways, but there's no way to guess if they will work with your document or not.Can you think of any other way to get an evenly formatted double spaced document out of my text without doing it all by hand?
If you can post a couple of pages from your document (your .odt file) as a sample, I expect there's some way to hammer it into shape.
AOO4/LO5 • Linux • Fedora 23
Re: How do I find and replace hidden paragraph marks?
What's wrong with acknak's approach?iamtherealandy wrote:The document I am working with is hundreds of pages long.
Can you think of any other way to get an evenly formatted double spaced document out of my text without doing it all by hand?
LibreOffice 7.3.7. 2; Ubuntu 22.04
Re: How do I find and replace hidden paragraph marks?
But acknak isn't suggesting you have to do it all by hand. Use the method he gave for deleting blank paragraphs. The only ones you'd have to remove by hand are the ones where you might have typed a non-printing character such as a space or a tab. If you didn't do that, then the find-and-replace he suggested will take care of all your hundreds of pages.iamtherealandy wrote:Can you think of any other way to get an evenly formatted double spaced document out of my text without doing it all by hand?
What might happen then, I'm guessing, is that everything might become single-spaced, no spacing between paragraphs. If that happens, adjust the paragraph style. To do this, click on any paragraph and press F11 to open the Stylist. Right-click on the highlighted paragraph style (probably Default) and choose Modify. Click the Indents and Spacing tab, and adjust the "Above paragraph" and/or "Below paragraph" to set the spacing you want between paragraphs.
Cheers!
---Fox
OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
---Fox
OOo 3.2.0 Portable, Windows 7 Home Premium 64-bit
Re: How do I find and replace hidden paragraph marks?
This worked for me: As acknack suggests do a search and replace with nothing, including regular expressions, but NOT "^$", just "$" [no quotes]. Then double space the entire document. The latter may require first selecting all the text [CTRL-A helps there], then choosing to edit the paragraph from the top formatting menu.
David.
David.
Re: How do I find and replace hidden paragraph marks?
Why this? Doesn't work with me, at least.Dave wrote:but NOT "^$", just "$"
I tested with the following text:
Code: Select all
Test1
Test2
Test3
Test4
Test5
Test6
Code: Select all
Test1Test2
Test3
Test4
Test5
Test6
Code: Select all
Test1
Test2
Test3
Test4
Test5
Test6
Should be working by using "\t", doesn't it?acknak wrote:Also, you can put text in the "Replace with:" box, but you'll find it next to impossible to put a tab in there.
If I e.g. apply to me last example (single line spacing) above a search for "$" (without "^" this time) and replace by "\t", I get
Code: Select all
Test1 Test2 Test3 Test4 Test5 Test6
Regards,
phil
OOo 3.0.1 & DEV-3.1 • WinXP pro 32-bit + SP3 + current patches
Looking for OpenOffice-related information? Try the search engine on OpenOfficeNinja - a great tool!
My favorite extension: Alt. Find & Replace for Writer. All you need and much more...
OOo 2.4.X on Ms Windows XP
Looking for OpenOffice-related information? Try the search engine on OpenOfficeNinja - a great tool!
My favorite extension: Alt. Find & Replace for Writer. All you need and much more...
OOo 2.4.X on Ms Windows XP
Re: How do I find and replace hidden paragraph marks?
Just my holey memory on both counts--thanks for testing and setting it straight.Phil wrote:Why this? Doesn't work with me, at least.Dave wrote:but NOT "^$", just "$"
I tested with the following text:
...Should be working by using "\t", doesn't it?acknak wrote:Also, you can put text in the "Replace with:" box, but you'll find it next to impossible to put a tab in there.
If I e.g. apply to me last example ...
I can't keep all of OOo's idiosyncrasies straight; usually I just fool around with it until it works
Dave's suggestion of using a plain '$' works for me, too. I'm not sure what's happened in your example.
I thought a plain '$' matched any paragraph boundary, so '^$' was needed to match empty paragraphs. It seems that '$' only matches empty paragraphs.
AOO4/LO5 • Linux • Fedora 23
Re: How do I find and replace hidden paragraph marks?
I fully agree it's really weird sometimes!acknak wrote:I can't keep all of OOo's idiosyncrasies straight; usually I just fool around with it until it works
My fault: Tested this on an old 2.3.1 install, which obviously contained a bug. Just tested again on 2.4.1 and 3.0 Beta 2, and the results for using both "$" and "^$" is now identical (and the correct result you would expect according to my 3rd code box above).acknak wrote:Dave's suggestion of using a plain '$' works for me, too. I'm not sure what's happened in your example.
I got quite puzzled as well!acknak wrote:I thought a plain '$' matched any paragraph boundary, so '^$' was needed to match empty paragraphs. It seems that '$' only matches empty paragraphs.
So I tested again. Used screenshots this time to see special characters.
Here's the test case: Doing a replace of "$" by the character "#" leads to: Doing a replace of "^$" by the character "#" leads to: To sum it up, "^$" applies to really empty paragraphs only (excluding spaces and tabs), whereas "$" seems to apply to paragraphs that do not contain text, but may contain spaces and tabs. The latter might indeed be helpful in the context of formatting documents.
Regards,
phil
OOo 3.0.1 & DEV-3.1 • WinXP pro 32-bit + SP3 + current patches
Looking for OpenOffice-related information? Try the search engine on OpenOfficeNinja - a great tool!
My favorite extension: Alt. Find & Replace for Writer. All you need and much more...
OOo 2.4.X on Ms Windows XP
Looking for OpenOffice-related information? Try the search engine on OpenOfficeNinja - a great tool!
My favorite extension: Alt. Find & Replace for Writer. All you need and much more...
OOo 2.4.X on Ms Windows XP
Re: How do I find and replace hidden paragraph marks?
(not more than 3 attachments allowed per post, therefore I continue in a new one)
Note that it also works for multiple consecutive paragraphs if replacing by an empty string instead of "#". So replacing "$" by nothing leads to:
Note that it also works for multiple consecutive paragraphs if replacing by an empty string instead of "#". So replacing "$" by nothing leads to:
OOo 3.0.1 & DEV-3.1 • WinXP pro 32-bit + SP3 + current patches
Looking for OpenOffice-related information? Try the search engine on OpenOfficeNinja - a great tool!
My favorite extension: Alt. Find & Replace for Writer. All you need and much more...
OOo 2.4.X on Ms Windows XP
Looking for OpenOffice-related information? Try the search engine on OpenOfficeNinja - a great tool!
My favorite extension: Alt. Find & Replace for Writer. All you need and much more...
OOo 2.4.X on Ms Windows XP
Re: How do I find and replace hidden paragraph marks?
Interesting--thanks, Phil. Nice work!
I wonder if any of this is helpful, or if the poster is long gone?
Oh well, the info is here if anyone else comes looking for it.
I wonder if any of this is helpful, or if the poster is long gone?
Oh well, the info is here if anyone else comes looking for it.
AOO4/LO5 • Linux • Fedora 23
Re: How do I find and replace hidden paragraph marks?
You're welcome!
Anyway, I came across that thing some time ago, as I had to reformat some text file, but didn't analyze in detail at that time.
So it was a good opportunity to catch up on that.
And as you say: it can serve as a reference for future questions.
Yes, that's a good question.acknak wrote:I wonder if any of this is helpful, or if the poster is long gone?
Anyway, I came across that thing some time ago, as I had to reformat some text file, but didn't analyze in detail at that time.
So it was a good opportunity to catch up on that.
And as you say: it can serve as a reference for future questions.
OOo 3.0.1 & DEV-3.1 • WinXP pro 32-bit + SP3 + current patches
Looking for OpenOffice-related information? Try the search engine on OpenOfficeNinja - a great tool!
My favorite extension: Alt. Find & Replace for Writer. All you need and much more...
OOo 2.4.X on Ms Windows XP
Looking for OpenOffice-related information? Try the search engine on OpenOfficeNinja - a great tool!
My favorite extension: Alt. Find & Replace for Writer. All you need and much more...
OOo 2.4.X on Ms Windows XP
- Portree
- Posts: 1
- Joined: Wed Aug 13, 2008 5:33 pm
- Location: Somewhere, wishing I was somewhere else.
Re: How do I find and replace hidden paragraph marks?
Okay, that is great info. Maybe you might be able to help me out with a similar issue.
I have a listing that has a lot of lines where the beginning and end of the line are the same but the content in between differs. I would like to delete all of them in one sweep. How do you use find and replace to get rid of a line when it is not blank? For example: If I do a find and replace using "a.*e$" as the search string and leave the 'Replace with' blank (with regular exp. checked) I get: This left a blank line when I had hoped that it would take out the line entirely like "^$" does for blank lines.
I did try "^a.*e$" as well and got the same result.
Any thoughts? I would really appreciate it.
Thanks.
I have a listing that has a lot of lines where the beginning and end of the line are the same but the content in between differs. I would like to delete all of them in one sweep. How do you use find and replace to get rid of a line when it is not blank? For example: If I do a find and replace using "a.*e$" as the search string and leave the 'Replace with' blank (with regular exp. checked) I get: This left a blank line when I had hoped that it would take out the line entirely like "^$" does for blank lines.
I did try "^a.*e$" as well and got the same result.
Any thoughts? I would really appreciate it.
Thanks.
OOo 2.4.X on openSuse 11 + Windows XP (in VBox)
Re: How do I find and replace hidden paragraph marks?
That is not possible with OOo Writer, out of the box.How do you use find and replace to get rid of a line when it is not blank?
You must either use the extension mentioned previously, or use several steps. E.g., use your example to first make the lines empty, then perform a second pass to remove the empty lines.
AOO4/LO5 • Linux • Fedora 23
Re: How do I find and replace hidden paragraph marks?
I know it's been over a month since this thread was active, but just incase anyone stumbles over this page at a future date, the best solution to the originally posted query is as follows:
In 'More Options', check 'Regular Expressions'
Search for: "^( *\t*)*$" [no quotes] (NOTE that the first character in the parenthesis is a space, followed by *\t*)
Replace with: <blank> [leave empty]
This will delete any whitespace lines, leaving you with purely text and carriage return lines.
The multiple carriage return lines can then be stripped out as previously stated with:
Search for: "^$" [no quotes]
Replace with: <blank> [leave empty]
[=== EXAMPLE ===]
So working on test input:
After running the search and replace on "^( *\t*)*$" you will get:
Then you can run the search and replace on "^$" to give you:
I'm sure there's a way to do it all in one go with regular expressions, but my first guess of regexp which was "^[ \t]*$" didn't seem to work, but a 2 step approach doesn't take that much longer and does just the same thing.
Hopefully this info will come in handy for someone at some stage in the future.
In 'More Options', check 'Regular Expressions'
Search for: "^( *\t*)*$" [no quotes] (NOTE that the first character in the parenthesis is a space, followed by *\t*)
Replace with: <blank> [leave empty]
This will delete any whitespace lines, leaving you with purely text and carriage return lines.
The multiple carriage return lines can then be stripped out as previously stated with:
Search for: "^$" [no quotes]
Replace with: <blank> [leave empty]
[=== EXAMPLE ===]
So working on test input:
Code: Select all
Line 1
Line 2
<sp><sp><sp>
Line 3
Line 4
<tab><tab><tab>
Line 5
<tab><tab><sp><sp><sp><tab><tab>
Line 6
<sp><sp><sp><tab><tab><tab>
Line 7
<tab><tab><sp><sp><sp>
Line 8
<sp><sp><sp>legit spaces<sp><sp><sp>
<tab><tab>legit tabs
<tab><tab><sp><sp><sp>legit tabs and spaces<sp><sp><tab>
Line 9
Code: Select all
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
<sp><sp><sp>legit spaces<sp><sp><sp>
<tab><tab>legit tabs
<tab><tab><sp><sp><sp>legit tabs and spaces<sp><sp><tab>
Line 9
Code: Select all
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
<sp><sp><sp>legit spaces<sp><sp><sp>
<tab><tab>legit tabs
<tab><tab><sp><sp><sp>legit tabs and spaces<sp><sp><tab>
Line 9
Hopefully this info will come in handy for someone at some stage in the future.
Re: How do I find and replace hidden paragraph marks?
Good explanation--thanks for the follow-up!
Nope. Two steps, as you showed, is the best you can do without a macro or extension.I'm sure there's a way to do it all in one go with regular expressions...
AOO4/LO5 • Linux • Fedora 23
-
- Posts: 1
- Joined: Mon Jan 12, 2009 5:10 pm
Re: How do I find and replace hidden paragraph marks?
Thank you. The solution works beautifully
OOo 3.0.X on MS Windows Vista