[Solved] Remove a paragraph mark between 2 paragraphs

Discuss the word processor
Post Reply
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

[Solved] Remove a paragraph mark between 2 paragraphs

Post by nomnex »

I don't find my answer in the previous thread nor in the http://www.oooninja.com regex or the writer regex guide, so thank you not redirecting me.

Question:
I past a document in simple text of a few paragraphs in Writer
In writer each paragraph ends with a paragraph mark (inversed P) + an empty paragraph (inversed P) + the next paragraph, etc.

para1para1 (inversed P)
(inversed P)
para2para2 (inversed P)
(inversed P)
para3para3 (Inversed P)

I apply header style and paragraph style to the text, and of course, I want to remove the paragraph mark between the 2 paragraph text.

If I search for "$" and replace with "(emtpy)"
- I get a unique paragraph - all the paragraph marks are removed.

If I search for "^$" and replace with "(emtpy)"
- it returns nothing - it only works in the case of there is double (inversed P) between 2 paragraph text.

I also tried search for "$$" and replace with "(empty)"
- it returns nothing - and I don't figure out when I can use it?

How do I remove all these empty lines (inversed P marks) between 2 paragraphs of text. Thank you.
Last edited by Hagar Delest on Sun Sep 04, 2011 11:58 pm, edited 2 times in total.
Reason: tagged [Solved].
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: How to remove a pragarph mark between 2 paragaphs of tex

Post by nomnex »

Is there a workaround because it looks like a bug to me.

^$ is definitely what I am looking for. I can search for "^$" and replace with "nothing" when I type a document in Writer. The empty paragraph lines are removed. It works as intended.

The command is ineffective with any simple text document I paste from a text editor (leafpad, bluefish, etc.) to Writer. Text paragraphs and paragraph marks display correctly in the writer document, but searching for "^$" is ineffective.

Could someone on Linux with OOo 3.3 (Oracle) try and get back to me. I hope I am wrong.
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Remove a pragarph mark between 2 paragaphs of text (Bug?

Post by RoryOF »

In Find box: ^$
In Replace box: nothing
Drop More Options and Select Regular Expressions (won't work without this)
Then press Replace All

Check that there is nothing for Attributes or Format until you get it working.

The reversed P is called a "Pilcrow", and derives from a mark used by mediaeval scribes to mark paragraph ends.
 Edit: If you are having difficulty we would like to see a short file; the Attach button is below the Send button on the Post a Reply window. 
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: Remove a pragarph mark between 2 paragaphs of text (Bug?

Post by nomnex »

RoryOF wrote:The reversed P is called a "Pilcrow", and derives from a mark used by mediaeval scribes to mark paragraph ends.
Pilcrow, I will keep that in mind, thanks.
 Edit: If you are having difficulty we would like to see a short file; the Attach button is below the Send button on the Post a Reply window. 
It makes sens. So far, on my system with a (default) configuration, it look like a bug. The feature works as expected when I type some paragraphs of text directly in Writer. I does not work for any paragraphs of text I paste from a simple text application to writer.

See next post for file samples (max attachments 3)
Attachments
Print-screen2 - F&R with direct input in writer
Print-screen2 - F&R with direct input in writer
Print-screen1 - F&R with text pasted from a simple text application
Print-screen1 - F&R with text pasted from a simple text application
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: Remove a pragarph mark between 2 paragaphs of text (Bug?

Post by nomnex »

sample files.

1. simple text sample created in Leafpad (simple text editor)
2. writer document in which I have pasted the content of the simple text sample

Can you try on your end?

[Deleted]
[Deleted]
Last edited by nomnex on Sat Sep 08, 2012 9:56 am, edited 1 time in total.
User avatar
Zizi64
Volunteer
Posts: 11353
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Remove a pragarph mark between 2 paragaphs of text (Bug?

Post by Zizi64 »

Hi,

Your sample_simple_text file in the .gz archive contains 0A 0A (hex) for line breaks but not 0D 0A (hex). (I viewed it with a hexa editor)

The 0A 0A means the line break singn in OOo (Shift-ENTER)
and the 0D 0A means the Paragraph break in OOo (Enter)
Pasted line breaks.png
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Remove a pragarph mark between 2 paragaphs of text (Bug?

Post by RoryOF »

In haste - no time to try your sample files. Tibor's diagnosis of some of the end of characters as being Line feeds (0A chars) suggests that you should search for \n to find them (Regular expressions must be checked). If you want to turn them into regular paragraph marks (Pilcrows), use \n in the Replace box (\n has different meaning in each box). If you just want to delete them, use nothing in the Replace box.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Remove a pragarph mark between 2 paragaphs of text (Bug?

Post by acknak »

Both of the attached files work as expected for me.

With the text file,
  • File > New > Text Document
    Insert > File > Name: sample_simple_text.txt (i.e., the unzipped text)
    Edit > Find & replace
    Search for: ^$
    Replace with: empty
Empty paragraphs are removed; others left unchanged.

If not sure it's helpful to think of the text breaks in Writer as corresponding to certain characters, as is the case for text files.
AOO4/LO5 • Linux • Fedora 23
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: Remove a paragraph mark between 2 paragraphs of text (Bu

Post by nomnex »

Thanks to everyone for your time and feedback

Zizi64 & RoryOF,
I don't know about hexa number and editor, and it confirms my impression, Writer does not interpret correctly copied & pasted simple text paragraphs (i.e. para break for line break) and it displays pilcrows (vs. line break marks). And F&R on empty paragraph lines is broken.

I gave another try opening a blank writer doc and copying the same text file. F & R using "\n" (Regex selected) returns the same error as in my first print-screen (see: print-screen below) You might want to give it a try when you have some free time.

acknak,
Insert > File (convert the simple text file 'to Writer formatting'). Thanks to point that out.

But ain't that a bug? I would expect a WYSIWYG word processor to past portion of text from other documents correctly. Insert > File is a all or nothing operation.

What do you think?
Attachments
F & R with "\n" returns search key not found on pasted text (as in the print-screen 1 above)
F & R with "\n" returns search key not found on pasted text (as in the print-screen 1 above)
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Remove a paragraph mark between 2 paragraphs of text (Bu

Post by acknak »

The \n matches line breaks, not paragraph breaks.

There are no line breaks in the .odt document attached and searching for \n finds no matches. Likewise, the text file doesn't produce them when you import it.

Cut and paste can lead to unusual results, depending on exactly what software is involved.
AOO4/LO5 • Linux • Fedora 23
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: Remove a paragraph mark between 2 paragraphs of text (Bu

Post by nomnex »

I read Zizi64 comment too fast.

He says the paragraph marks in the text file are line breaks in the simple text document (an not in Writer - as I read first) How could that be? A simple text editor don't produce line breaks to my knowledge. Either copying from a wiki desktop: Zim, an email client: sylpheed, or my text editor - all are simple text applications - and pasting in Writer give the same problem. I can't remove the empty lines.

Note: I don't have this problem when I past HTML formatted text, the <p> tags are dully interpreted in writer, and there is no empty line.

So no easy way to copy and past simple text documents in writer (except "File > Import"), and to search for and remove empty lines between the paragraphs?

Out of curiosity is it the same in the LO version, if anyone has a version at hand.
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Remove a paragraph mark between 2 paragraphs of text (Bu

Post by RoryOF »

I have tried sample_simple_text_copied_to_odf.odt, using OOo 3.3 on Ubuntu 10.10, replacing the line end options with % to show its location

Find $ replaces four Paragraph marks

Code: Select all

line 1 %¶
line 2 %¶
line 3 %¶
line 4 %¶
line 5¶
Find ^$ replaces four Paragraph marks

Code: Select all

line 1 ¶
%line 2 ¶
%line 3 ¶
%line 4 ¶
%line 5¶
One can see that it is finding the correct line end in each case. I'm not worried about the last one - special handling for one end of file indicator is not unusual or a great burden.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: Remove a paragraph mark between 2 paragraphs of text (Bu

Post by nomnex »

It looks like I was wrong about end of line in simple text editor http://en.wikipedia.org/wiki/Newline

RoryOF last comment:

I can reproduce it and that's a step forward. Any of my previous "copy/past & search/replace" were done in a new Writer document.

To sum up:

1a. Open a simple text editor
1b. Type some text lines separated by an empty line
1c. Copy the content in the clipboard
2a. Open a new Writer document
2b. Past the content of the clipboard in the Writer document
2c. Find and Replace "^$" (Regex)
It fails (msg. Search key not found)
3a. Save the document
3b. Find and Replace "^$" (Regex)
It fails again (msg. Search key not found)
4a. Close and re-open the document
4b. Find and Replace "^$" (Regex)
Works as expected.

As awkward as it is, a writer document as to be saved, closed & re-opened to remove the empty lines.
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: [Solved] Remove a paragraph mark between 2 paragraphs

Post by nomnex »

I usually wait ~2 weeks before to mark a question [Solved], in the event people want to add comments/bring new relevant information. I am not positive, but as far as I can remember, I didn't change the subject as solved. Has someone done it on my behave?
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Solved] Remove a paragraph mark between 2 paragraphs

Post by Hagar Delest »

It's me as mentioned in the bottom of your first post.
It seems that you've found a solution, that's why I've tagged it solved. Usually, very few users care to do it. If you disagree, edit your post, remove the tag and the green tick-mark.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: [Solved] Remove a paragraph mark between 2 paragraphs

Post by nomnex »

Hagar Delest wrote:It's me as mentioned in the bottom of your first post.
No problem here. It used to be a time you, or the other mood, wrote "please change the title as solved if...". I usually revisit my questions, but if you update the posts status on your own, be welcome to do so. I did not occur me to look at the bottom of the first post. I will do next time.
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Solved] Remove a paragraph mark between 2 paragraphs

Post by Hagar Delest »

nomnex wrote:It used to be a time you, or the other mood, wrote "please change the title as solved if...".
Not all mods do that. I add this when I engage in a thread and when there is a proposal that should fix the problem (there are some case where you can't so no need to put it).
nomnex wrote:I did not occur me to look at the bottom of the first post. I will do next time.
I know. Visibility of the edit is not that good. Very few notice it.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Post Reply