[Solved] Replace linebreak, new paragraph ...
[Solved] Replace linebreak, new paragraph ...
I cannot figure out how to replace "end of paragraph" hidden character with "end of line"+"end of paragraph".
When I choose More options and check regular expressions, and I use "$" for search for and "\n$" for replace with, then it replaces "end of paragraph" with "end of paragraph"+dollar sign.
If I try to replace "end of paragraph" with "end of line" using $ and \n correspondingly, I end up with replacing "end of paragraph" by "end of paragraph".
It is kind of weird.
Can someone help me, please?
PS winXP, Open Office 2.3.1
When I choose More options and check regular expressions, and I use "$" for search for and "\n$" for replace with, then it replaces "end of paragraph" with "end of paragraph"+dollar sign.
If I try to replace "end of paragraph" with "end of line" using $ and \n correspondingly, I end up with replacing "end of paragraph" by "end of paragraph".
It is kind of weird.
Can someone help me, please?
PS winXP, Open Office 2.3.1
Last edited by niasilil on Tue Dec 11, 2007 8:31 am, edited 1 time in total.
Re: replace linebreak, new paragraph ...
I don't understand what you're trying to accomplish. Why do you need the sequence: "end of line"+"end of paragraph"?
AOO4/LO5 • Linux • Fedora 23
Re: replace linebreak, new paragraph ...
Thank you for the interest.
There are number of tasks I want to do, but I do not know how to do them.
For example, if every line of the text ends with a space (or a tab), I want to remove these spaces(tabs). So I go to replace and find space + end_of_paragraph and replace it with end_of_paragraph". This happens when I have a table copy/pasted from a different source. If each line is ending with a space, then I need to remove these spaces to be able to convert the text to a table.
Another example would be to replace a space to end_of_line in selected portion of the text. If I replace a space with a end_of_line, I get end_of_paragraph in the result. I am wondering if it is a bug or a feature. I could not find the answer anywhere.
The question is not "why?", the question is "how?".
There are number of tasks I want to do, but I do not know how to do them.
For example, if every line of the text ends with a space (or a tab), I want to remove these spaces(tabs). So I go to replace and find space + end_of_paragraph and replace it with end_of_paragraph". This happens when I have a table copy/pasted from a different source. If each line is ending with a space, then I need to remove these spaces to be able to convert the text to a table.
Another example would be to replace a space to end_of_line in selected portion of the text. If I replace a space with a end_of_line, I get end_of_paragraph in the result. I am wondering if it is a bug or a feature. I could not find the answer anywhere.
The question is not "why?", the question is "how?".
Re: replace linebreak, new paragraph ...
Enter " $" in the Search box (without the quotation marks); $ is a marker for the end-of-line you're looking for. Enter nothing in the Replace by box. First select a few lines and apply it there to make sure it does what you want it to do. You cannot replace across paragraphs, that's serious limitation of OOo. That means that you can't replace spaces by paragraph ends.
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
Re: replace linebreak, new paragraph ...
OOo's Find & Replace takes a lot of getting used to.
Search for: [space,tab]+$ (type an actual space and tab, no comma)
Replace with: empty
Options > Regular expressions = YES
Replace All
The big trick here is "how to type a tab?". In this case, the only way is to copy one from the document text, then paste it in the "Search for" box.
Alternatively, you could use this pattern: (space|\t)+$
In either case, the "$" represents only a position, not an actual character, so there is no need to include it in the replacement. The "Search for" pattern simply matches one or more spaces or tabs at the end of any line.
You can do it one at a time, clicking "Find Next" and typing a Shift+Enter (not so great, right?)
You may want to read the Regular Expressions in Writer How-To.
If you really need to do this a lot, I strongly suggest that you preprocess the text (using good text utilities or a text editor) before it gets into Writer. You may actually need to make simple HTML, since Writer's text import can't distinguish line breaks from paragraph breaks.
[*] I just noticed that, in Linux, I can type a line-break in the "replace with" entry using the Unicode input sequence: Ctrl+Shift+u, a, space. That inserts a U+000a, or ascii linefeed character, which Writer uses as a line break in the text. It may work in Windows using the Alt+010 on the number pad.
Edit > Find & Replace... if every line of the text ends with a space (or a tab), I want to remove these spaces(tabs).
Search for: [space,tab]+$ (type an actual space and tab, no comma)
Replace with: empty
Options > Regular expressions = YES
Replace All
The big trick here is "how to type a tab?". In this case, the only way is to copy one from the document text, then paste it in the "Search for" box.
Alternatively, you could use this pattern: (space|\t)+$
In either case, the "$" represents only a position, not an actual character, so there is no need to include it in the replacement. The "Search for" pattern simply matches one or more spaces or tabs at the end of any line.
Short answer: you can't. There is no provision for using a line break in the replacement text[*].Another example would be to replace a space to end_of_line in selected portion of the text. If I replace a space with a end_of_line, I get end_of_paragraph in the result.
You can do it one at a time, clicking "Find Next" and typing a Shift+Enter (not so great, right?)
It's a buggy, incomplete implementation of a design that was never meant for word-processing. Even so, it's very useful once you get the hang of it.I am wondering if it is a bug or a feature. I could not find the answer anywhere.
You may want to read the Regular Expressions in Writer How-To.
If you really need to do this a lot, I strongly suggest that you preprocess the text (using good text utilities or a text editor) before it gets into Writer. You may actually need to make simple HTML, since Writer's text import can't distinguish line breaks from paragraph breaks.
[*] I just noticed that, in Linux, I can type a line-break in the "replace with" entry using the Unicode input sequence: Ctrl+Shift+u, a, space. That inserts a U+000a, or ascii linefeed character, which Writer uses as a line break in the text. It may work in Windows using the Alt+010 on the number pad.
AOO4/LO5 • Linux • Fedora 23
Re: replace linebreak, new paragraph ...
Oops. You can replace spaces with paragraph ends (use "\n" in the replacement); you can't replace anything with line-breaks, unless you use the trick I mentioned above.floris_v wrote:You cannot replace across paragraphs, that's serious limitation of OOo. That means that you can't replace spaces by paragraph ends.
In the "Search for" pattern, "\n" stands for a line-break. In the "Replace with" text, it stands for a paragraph break. Go figure.
AOO4/LO5 • Linux • Fedora 23
Re: replace linebreak, new paragraph ...
My bad, must have forgotten to hit the regexp checkbox when I tried that.
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
Re: replace linebreak, new paragraph ...
Thanks for posting that.acknak wrote:I just noticed that, in Linux, I can type a line-break in the "replace with" entry using the Unicode input sequence: Ctrl+Shift+u, a, space. That inserts a U+000a, or ascii linefeed character, which Writer uses as a line break in the text. It may work in Windows using the Alt+010 on the number pad.
Is "Ctrl+Shift+u, a, Space" a unicode input method universal to all breeds of Linux?
In Windows I unsuccessfully tried some of the various methods linked here http://www.fileformat.info/info/unicode/char/000a/ - I couldn't test all methods due to not having admin rights to set them up.
Re: replace linebreak, new paragraph ...
I honestly doubt that there is any feature that is "universal to all breeds of Linux". I guess that's the down side of being so easily modified.Is "Ctrl+Shift+u, a, Space" a unicode input method universal to all breeds of Linux?
The "Ctrl+Shift+u... space" is part of the Gtk toolkit, so any application that uses the stock Gtk text widgets will provide this method. So Gnome apps provide it; KDE does something different (as far as I know). Unfortunately, the sequence is not standard across toolkits, or interfaces: the Linux text console uses Alt+nnn; emacs provides several other alternatives.
OOo uses Gtk but not the standard Gtk widgets. However, OOo does seem to provide this input method wherever you can type text.
AOO4/LO5 • Linux • Fedora 23
Re: replace linebreak, new paragraph ...
Thank you very much for the answers. It is better now. I can live without having "end of line" in the replace box.
I am marking this thread as solved
The idea was kind of opposite. I was trying to migrate from MSOffice to OOo.acknak wrote:If you really need to do this a lot, I strongly suggest that you preprocess the text (using good text utilities or a text editor) before it gets into Writer. You may actually need to make simple HTML, since Writer's text import can't distinguish line breaks from paragraph breaks.
I am marking this thread as solved
Re: [solved] replace linebreak, new paragraph ...
MSOffice is not what I meant by "a good text editor"--neither is Notepad or Wordpad
Someone else will have to give you a recommendation for a good Windows editor. I use Emacs on Linux, and it runs on Windows and is free, but it's not exactly "friendly".
Here's one example of what I'm talking about: Notepad++[wikipedia.org]. That's just a sample, not an endorsement.
Someone else will have to give you a recommendation for a good Windows editor. I use Emacs on Linux, and it runs on Windows and is free, but it's not exactly "friendly".
Here's one example of what I'm talking about: Notepad++[wikipedia.org]. That's just a sample, not an endorsement.
AOO4/LO5 • Linux • Fedora 23