[Solved] Remove extra line breaks

Discuss the word processor

[Solved] Remove extra line breaks

Postby Harry_Steele » Sun Nov 17, 2019 12:14 pm

Hi, all. I downloaded a book in text format. It's about 300 pages long. When I go to open it to edit it, I get a "General Error" message. Maybe it's because of its size, but I thought I'd ask if there's some other reason for the error message.

Also, the reason I need to edit it is because when I open it in Wordpad, the format is not standard. That is, the lines of the blocks of text do not extend the full width of the page. I started to laboriously go through and bring each line up to join its previous line to make it print as an A4, but 300 pages... :knock:

So, is there a way, in any text editor, to make lines "backspace" to the line before and thus make the paragraphs the full A4 printing width? Hope that makes sense.

Thanks.

Title Edited. A descriptive title for posts helps others who are searching for solutions and increases the chances of a reply [robleyd, Moderator]. Was Save me hours..
Last edited by MrProgrammer on Mon Nov 18, 2019 4:13 am, edited 2 times in total.
Reason: Title Edited; Tagged ✓ [Solved]
OpenOffice 4.1.6 on MacOS 10.9
Harry_Steele
 
Posts: 9
Joined: Sun Nov 03, 2019 12:03 pm

Re: Save me hours..

Postby RoryOF » Sun Nov 17, 2019 3:07 pm

I can't answer for why OO is not opening your file. A Mac user may have some help.

A downloadable plain text file has normally each line terminated with Enter, so it reads as a paragraph in OpenOffice. In such cases, each paragraph may be marked by a blank line. Turn on /View /non printing characters to see the structure. Paragraph marks are a Pilcrow )Backwards P)

How I solve this is, using /Edit /Find and Replace

In Find, insert ^$
In Replace insert %%%%
Drop More Options, select Regular expressions.
Press Replace All

In Find, insert $
In Replace insert a space
Check that Regular expressions is still selected
Press Replace All

In Find, insert %%%%
In Replace insert \n
Check that Regular expressions is still selected
Press Replace All

Your book should now have reasonable formatting.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29870
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Remove extra line breaks

Postby robleyd » Sun Nov 17, 2019 3:10 pm

So, is there a way, in any text editor, to make lines "backspace" to the line before


Depending on the capabilities of the specific text editor, Find/Replace will usually solve this sort of problem of unwanted line breaks. For OpenOffice Writer, see this post by RoryOF which provides several solutions depending on exactly how the line breaks are structured. I don't use WordPad so can't comment on what it might be able to do.
Cheers
David
Apache OpenOffice 420m2(Build:9821) - Slackware 14.2 - 64 bit
LibreOffice 6.0.7.3 - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 3057
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Remove extra line breaks

Postby Harry_Steele » Mon Nov 18, 2019 3:11 am

Thanks for that, gents. I'll make my post headings clearer in future.

Thanks for the tips, Rory. I'm on a Mac, so maybe it's a Mac thing..
OpenOffice 4.1.6 on MacOS 10.9
Harry_Steele
 
Posts: 9
Joined: Sun Nov 03, 2019 12:03 pm

Re: Remove extra line breaks

Postby Harry_Steele » Mon Nov 18, 2019 3:54 am

Ahhh, thanks guys. That worked. Well, it almost worked. The lines are now joined, and the paragraphs are now full width. Unfortunately, there is now a "hyphen" in the form of a dot, between each word.

I tried Find and replace to turn the dot/hyphen into a space, but it didn't work.

So, nearly there. What do I do next :)

EDIT: :ucrazy: Oops! I forgot to turn off "non-printing characters".... All good now. :D

Thanks again for your very helpful responses. :super:
OpenOffice 4.1.6 on MacOS 10.9
Harry_Steele
 
Posts: 9
Joined: Sun Nov 03, 2019 12:03 pm

Re: [Solved] Remove extra line breaks

Postby RoryOF » Mon Nov 18, 2019 10:09 am

Most doing serious document editing will leave /View /non printing characters enabled, as it allows a view into low level formatting errors.

 Edit: On a document being edited, this setting will show unwanted spaces, tabs, and line endings, all which can cause formatting problems difficult to sort out without knowledge of the presence of such intrusive characters. 
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29870
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Solved] Remove extra line breaks

Postby Harry_Steele » Mon Nov 18, 2019 10:30 am

Thanks, Rory, sounds like a good idea. :super:
OpenOffice 4.1.6 on MacOS 10.9
Harry_Steele
 
Posts: 9
Joined: Sun Nov 03, 2019 12:03 pm


Return to Writer

Who is online

Users browsing this forum: No registered users and 11 guests