Using Replace to remove line breaks

Discuss the word processor

Using Replace to remove line breaks

Postby Dr Spyn » Mon Jan 14, 2019 10:54 pm

I have a long text document with manual single line breaks I'd like to replace with a space. When I place \n in the Search For field and a space in the Replace With field, then click on Replace All, the message "Search Key Not Found" appears. Please reply with a verbose step-by-step explanation as I'm a nitwit.
OpenOffice Ver. 4.1.5/Rev. 1817496/2017-12-11 17:25/Win 10
Dr Spyn
Posts: 2
Joined: Mon Jan 14, 2019 10:34 pm

Re: Using Replace to remove line breaks

Postby Zizi64 » Mon Jan 14, 2019 11:43 pm

When I place \n in the Search For field and

The \n will search an find the Shift-Enter type line breaks only - if the Regular Expressions option is checked in the other options area of the dialog.
Please stusy the the Regular expressions in the HELP or on this page: ... xpressions
Tibor Kovacs, Hungary; LO4.4.7, LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.4; AOO4.1.5
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
Posts: 7970
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Using Replace to remove line breaks

Postby RoryOF » Mon Jan 14, 2019 11:50 pm

Turn on /View /Non printing characters.

Note the line ends - are they left pointing hooked arrows (line breaks) or backwards P characters (Pilcrows)? If the left arrows, enter \n in Find. If Pilcrows, enter $ in Find. In either case in Replace enter a single space.

Before clicking Replace All button, drop More Options on the F&R window and select "Regular Expressions". Now click Replace All.

Be advised that if your document is long - more than 64K characters (say about 10,000 words)- this is not a good thing to do, as OO hangs with paragraphs longer than 64K characters, often about 15 pages.

The non printing characters display does not print, and is turned off by using the same command (or pressing the backwards P button on the toolbar).
Apache OpenOffice 4.1.6 on Xubuntu 18.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
Posts: 28930
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Using Replace to remove line breaks

Postby esperantisto » Tue Jan 15, 2019 4:16 pm

You might want to try the Process ends of lines/paragraphs… feature of OOoFBTools.
AOO 4.2.0 / LibO 5.x/6.x / Win 7 / openSUSE Linux 11.3 (32-bit) / 13.2 (64-bit)
Posts: 486
Joined: Mon Oct 08, 2007 1:31 am

Return to Writer

Who is online

Users browsing this forum: No registered users and 31 guests