[Solved] Find & replace carriage returns
-
- Posts: 38
- Joined: Wed Jan 04, 2012 11:38 pm
[Solved] Find & replace carriage returns
I seem to remember that there's a way to do this in OO - but I can't remember how.
I would like to go through a document and replace all the carriage returns (line breaks) with a character (say an asterisk) - is there a way to do that? And then, when I've done what I have to, then replace the asterisks again with carriage returns (line breaks) .... there's got to be a way to do that.
w
I would like to go through a document and replace all the carriage returns (line breaks) with a character (say an asterisk) - is there a way to do that? And then, when I've done what I have to, then replace the asterisks again with carriage returns (line breaks) .... there's got to be a way to do that.
w
Last edited by Hagar Delest on Sun Jan 20, 2013 12:44 pm, edited 1 time in total.
Reason: tagged solved.
Reason: tagged solved.
OpenOffice 3.3.0 on Mac OS 10.7
Re: find & replace carraige returns
Find \n Replace **** , More Options to have Regular Expressions checked.
Beware! OpenOffice does not like paragraphs longer than 64KB.
Beware! OpenOffice does not like paragraphs longer than 64KB.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
Re: find & replace carraige returns
First, make be what you're working with: View > Nonprinting characters: ON
Now, paragraph breaks will show as ¶ and line breaks will show as arrows: ↵
To replace the line breaks,
Edit > Find & Replace
Search for: \n
Replace with: some character
Options/Regular expressions: ON
Click "Replace all"
Now, paragraph breaks will show as ¶ and line breaks will show as arrows: ↵
To replace the line breaks,
Edit > Find & Replace
Search for: \n
Replace with: some character
Options/Regular expressions: ON
Click "Replace all"
AOO4/LO5 • Linux • Fedora 23
-
- Posts: 38
- Joined: Wed Jan 04, 2012 11:38 pm
-
- Posts: 38
- Joined: Wed Jan 04, 2012 11:38 pm
Re: find & replace carriage returns
Hmmm.. I get "search key not found."
actually, I wasn't thinking about the difference between paragraph breaks and line breaks - what I'm trying to replace is paragraph breaks (hard returns) rather than line breaks...
here's the find window - is everything kosher here?
thanks!
w
actually, I wasn't thinking about the difference between paragraph breaks and line breaks - what I'm trying to replace is paragraph breaks (hard returns) rather than line breaks...
here's the find window - is everything kosher here?
thanks!
w
OpenOffice 3.3.0 on Mac OS 10.7
Re: find & replace carriage returns
If you want to manipulate paragraph breaks, you probably need to use the "AltSearch" extension: http://extensions.openoffice.org/en/project/AltSearch
Writer alone is very limited. You can replace a paragraph break using the single character $ in the search-for box. If you replace enough of them (remember, this joins paragraphs together) to make a single paragraph that's too long (~15 letter-size pages, single-spaced) you may lose the overflow.
Writer alone is very limited. You can replace a paragraph break using the single character $ in the search-for box. If you replace enough of them (remember, this joins paragraphs together) to make a single paragraph that's too long (~15 letter-size pages, single-spaced) you may lose the overflow.
AOO4/LO5 • Linux • Fedora 23
Re: find & replace carriage returns
Try Find $ Replace *, Regular Expressions checked etc.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
-
- Posts: 38
- Joined: Wed Jan 04, 2012 11:38 pm
Re: Find & replace carriage returns
Okay, I now have the ALT FIND & REPLACE installed.
in this block of text,
1. Caution Blues [Blues In Thirds] (A) 2:58*@(Earl Hines)*@2. A Monday Date (A) 3:17*@(Earl Hines)*@3. I Ain’t Got Nobody And Nobody Cares For Me (B) 3:12*@(Graham-Williams-Peyton)*@4. 57 Varieties (B) 3:14*@(Earl Hines)*@5. Sweet Ella May (C) 2:42*@(Alpert-Renard-Robinson)*@6. Everybody Loves My Baby (C) 3:15*@(J. Palmer-S. Williams)*@7. Good Little, Bad Little You (D) 2:33*@(B. Green-S. Stept)*@8. Have You Ever Felt That Way (D) 3:02*@(S. Williams-A. Castleton)*@9. Beau-Koo Jack (E) 2:47*@(Armstrong-Hill-Melrose)*@10. Sister Kate (E) 3:04*@(A.J. Piron)*@
I'm trying to replace
)*@
with paragraph breaks "\p"
so that it looks like
1. Caution Blues [Blues In Thirds] (A) 2:58*@(Earl Hines
2. A Monday Date (A) 3:17*@(Earl Hines
3. I Ain’t Got Nobody And Nobody Cares For Me (B) 3:12*@(Graham-Williams-Peyton
ETC
I can't figure out how to replace a "regular expression" with a "non-regular expression."
If I have "regular expressions" un-checked, it can find the ")*@" but it replaces it with just \p, not an actual paragraph break - and vice versa, If I have "regular expressions" checked, then it can't find the ")*@" -
any suggestions?
thanks again...
W
in this block of text,
1. Caution Blues [Blues In Thirds] (A) 2:58*@(Earl Hines)*@2. A Monday Date (A) 3:17*@(Earl Hines)*@3. I Ain’t Got Nobody And Nobody Cares For Me (B) 3:12*@(Graham-Williams-Peyton)*@4. 57 Varieties (B) 3:14*@(Earl Hines)*@5. Sweet Ella May (C) 2:42*@(Alpert-Renard-Robinson)*@6. Everybody Loves My Baby (C) 3:15*@(J. Palmer-S. Williams)*@7. Good Little, Bad Little You (D) 2:33*@(B. Green-S. Stept)*@8. Have You Ever Felt That Way (D) 3:02*@(S. Williams-A. Castleton)*@9. Beau-Koo Jack (E) 2:47*@(Armstrong-Hill-Melrose)*@10. Sister Kate (E) 3:04*@(A.J. Piron)*@
I'm trying to replace
)*@
with paragraph breaks "\p"
so that it looks like
1. Caution Blues [Blues In Thirds] (A) 2:58*@(Earl Hines
2. A Monday Date (A) 3:17*@(Earl Hines
3. I Ain’t Got Nobody And Nobody Cares For Me (B) 3:12*@(Graham-Williams-Peyton
ETC
I can't figure out how to replace a "regular expression" with a "non-regular expression."
If I have "regular expressions" un-checked, it can find the ")*@" but it replaces it with just \p, not an actual paragraph break - and vice versa, If I have "regular expressions" checked, then it can't find the ")*@" -
any suggestions?
thanks again...
W
OpenOffice 3.3.0 on Mac OS 10.7
Re: Find & replace carriage returns
Instead of \p use \n. \p is used in MS Word; OpenOffice uses \n.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
-
- Posts: 38
- Joined: Wed Jan 04, 2012 11:38 pm
Re: Find & replace carriage returns
thanks, but it's the same difference, it inserts the code as code rather than the line break (or carriage return) that it's supposed to represent,
this is what I get :
1. Caution Blues [Blues In Thirds] (A) 2:58*@(Earl Hines\n2. A Monday Date (A) 3:17*@(Earl Hines\n3. I Ain’t Got Nobody And Nobody Cares For Me (B) 3:12*@(Graham-Williams-Peyton\n
and THIS is what I want :
1. Caution Blues [Blues In Thirds] (A) 2:58*@(Earl Hines
2. A Monday Date (A) 3:17*@(Earl Hines
3. I Ain’t Got Nobody And Nobody Cares For Me (B) 3:12*@(Graham-Williams-Peyton
I have tried it with "regular expressions" both checked and unchecked, and I don't get the right result either way...
thanks for any additional input!
w
this is what I get :
1. Caution Blues [Blues In Thirds] (A) 2:58*@(Earl Hines\n2. A Monday Date (A) 3:17*@(Earl Hines\n3. I Ain’t Got Nobody And Nobody Cares For Me (B) 3:12*@(Graham-Williams-Peyton\n
and THIS is what I want :
1. Caution Blues [Blues In Thirds] (A) 2:58*@(Earl Hines
2. A Monday Date (A) 3:17*@(Earl Hines
3. I Ain’t Got Nobody And Nobody Cares For Me (B) 3:12*@(Graham-Williams-Peyton
I have tried it with "regular expressions" both checked and unchecked, and I don't get the right result either way...
thanks for any additional input!
w
OpenOffice 3.3.0 on Mac OS 10.7
Re: Find & replace carriage returns
Thanks. It's much simpler to help when there is a clear sample!willfriedwald wrote:... in this block of text, ... I'm trying to replace )*@ with paragraph breaks "\p" so that it looks like ...
...
Edit > Find & Replace
Search for: \)\*@
Replace with: \n
Options/Regular expressions: ON
Click "Replace All"
That works for me with your sample.
AOO4/LO5 • Linux • Fedora 23
-
- Posts: 38
- Joined: Wed Jan 04, 2012 11:38 pm
Re: Find & replace carriage returns
and for me too! thanks! this worked in the standard "find & replace," I didn't even need to implement the "alt find & replace!"
will
will
OpenOffice 3.3.0 on Mac OS 10.7
Re: [Solved] Find & replace carriage returns
One note that might help someone else struggling (as I was) until I experimented a bit.
It's counter-intuitive, but sometimes you want to replace \n with \n.
You would want to do this when you want to replace the line breaks (like you get when you're pasting from the web) with actual paragraph breaks. As mentioned above, if you have nonprinting characters turned on, the paragraph breaks show as ¶ and line breaks will show as arrows: ↵
For some inexplicable reason, the \n in the Find box matches the line breaks (↵), yet in the Replace box, the \n inserts a paragraph break (¶).
Heaven help the person who wants to replace paragraph breaks with line breaks, I guess
It's counter-intuitive, but sometimes you want to replace \n with \n.
You would want to do this when you want to replace the line breaks (like you get when you're pasting from the web) with actual paragraph breaks. As mentioned above, if you have nonprinting characters turned on, the paragraph breaks show as ¶ and line breaks will show as arrows: ↵
For some inexplicable reason, the \n in the Find box matches the line breaks (↵), yet in the Replace box, the \n inserts a paragraph break (¶).
Heaven help the person who wants to replace paragraph breaks with line breaks, I guess

OpenOffice 3.4.1 on Windows 7 / some other version on my home laptop