[Solved] Remove a paragraph mark between 2 paragraphs

Discuss the word processor

[Solved] Remove a paragraph mark between 2 paragraphs

Postby nomnex » Wed Aug 31, 2011 4:00 am

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].
OpenOffice.org Writer isn't a replacement for anything; it's simply a better piece of software -- Bruce Byfield
[LO 3.3.4 on Fedora 15 LXDE]
User avatar
nomnex
 
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm
Location: Japan

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

Postby nomnex » Wed Aug 31, 2011 4:14 am

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.
OpenOffice.org Writer isn't a replacement for anything; it's simply a better piece of software -- Bruce Byfield
[LO 3.3.4 on Fedora 15 LXDE]
User avatar
nomnex
 
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm
Location: Japan

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

Postby RoryOF » Wed Aug 31, 2011 7:30 am

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.0.1 on Xubuntu 14.04 and Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 14376
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Postby nomnex » Wed Aug 31, 2011 12:00 pm

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
02_find_and_replace_direct_input_in_writer.png
Print-screen2 - F&R with direct input in writer
01_find_and_replace_simple_text_pasted_in_writer.png
Print-screen1 - F&R with text pasted from a simple text application
OpenOffice.org Writer isn't a replacement for anything; it's simply a better piece of software -- Bruce Byfield
[LO 3.3.4 on Fedora 15 LXDE]
User avatar
nomnex
 
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm
Location: Japan

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

Postby nomnex » Wed Aug 31, 2011 12:11 pm

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.
OpenOffice.org Writer isn't a replacement for anything; it's simply a better piece of software -- Bruce Byfield
[LO 3.3.4 on Fedora 15 LXDE]
User avatar
nomnex
 
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm
Location: Japan

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

Postby Zizi64 » Wed Aug 31, 2011 12:35 pm

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; AOO4.0.1, LO3.6.4, LO4.2.2 on WinXPprof.SP3
Zizi64
Volunteer
 
Posts: 1784
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby RoryOF » Wed Aug 31, 2011 5:57 pm

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.0.1 on Xubuntu 14.04 and Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 14376
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Postby acknak » Wed Aug 31, 2011 9:01 pm

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.
AOO 4 • Linux • Fedora 17
User avatar
acknak
Moderator
 
Posts: 17421
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

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

Postby nomnex » Thu Sep 01, 2011 7:01 am

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
same as ^$.png
F & R with "\n" returns search key not found on pasted text (as in the print-screen 1 above)
OpenOffice.org Writer isn't a replacement for anything; it's simply a better piece of software -- Bruce Byfield
[LO 3.3.4 on Fedora 15 LXDE]
User avatar
nomnex
 
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm
Location: Japan

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

Postby acknak » Thu Sep 01, 2011 7:47 am

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.
AOO 4 • Linux • Fedora 17
User avatar
acknak
Moderator
 
Posts: 17421
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

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

Postby nomnex » Thu Sep 01, 2011 8:37 am

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.
OpenOffice.org Writer isn't a replacement for anything; it's simply a better piece of software -- Bruce Byfield
[LO 3.3.4 on Fedora 15 LXDE]
User avatar
nomnex
 
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm
Location: Japan

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

Postby RoryOF » Thu Sep 01, 2011 8:53 am

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   Expand viewCollapse view
line 1 %¶
line 2 %¶
line 3 %¶
line 4 %¶
line 5¶


Find ^$ replaces four Paragraph marks
Code: Select all   Expand viewCollapse view
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.0.1 on Xubuntu 14.04 and Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 14376
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Postby nomnex » Thu Sep 01, 2011 9:29 am

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.
OpenOffice.org Writer isn't a replacement for anything; it's simply a better piece of software -- Bruce Byfield
[LO 3.3.4 on Fedora 15 LXDE]
User avatar
nomnex
 
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm
Location: Japan

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

Postby nomnex » Thu Sep 08, 2011 2:57 am

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?
OpenOffice.org Writer isn't a replacement for anything; it's simply a better piece of software -- Bruce Byfield
[LO 3.3.4 on Fedora 15 LXDE]
User avatar
nomnex
 
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm
Location: Japan

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

Postby Hagar Delest » Thu Sep 08, 2011 8:29 am

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.
AOO 4.0.1 on Windows 7 and Xubuntu 14.04 (Trusty Tahr)
User avatar
Hagar Delest
Moderator
 
Posts: 25106
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

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

Postby nomnex » Sat Sep 10, 2011 3:52 pm

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.
OpenOffice.org Writer isn't a replacement for anything; it's simply a better piece of software -- Bruce Byfield
[LO 3.3.4 on Fedora 15 LXDE]
User avatar
nomnex
 
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm
Location: Japan

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

Postby Hagar Delest » Sat Sep 10, 2011 10:05 pm

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.
AOO 4.0.1 on Windows 7 and Xubuntu 14.04 (Trusty Tahr)
User avatar
Hagar Delest
Moderator
 
Posts: 25106
Joined: Sun Oct 07, 2007 9:07 pm
Location: France


Return to Writer

Who is online

Users browsing this forum: No registered users and 20 guests