Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I delete blank lines using search and replace

How do I delete blank lines using search and replace

MacBook Pro, OS X Yosemite (10.10), 8 GB RAM

Posted on Apr 24, 2015 12:03 AM

Reply
21 replies

Dec 10, 2016 7:52 AM in response to Skyeword

You may have made extra work for yourself. But you can go back to an original version.


I use TextWrangler or BBedit usually, even TextEdit. LibreOffice would be fine.


NisusWriter is also excellent as it allows you to use GREP.


First step is always to find and mark the paragraph returns, which are usually 2 returns. Mark those with a unique replacement, I usually use <#>.


Then find and replace all the soft returns, replacing those with word spaces. Then go back to find <#> and replace that with a return.


You will need also to search and replace on multiple spaces, spaces inside brackets, before punctuation, tabs and after returns, multiple tabs, multiple returns etc.


Never, EVER do things manually, you will usually only make matters worse.


Peter

Dec 12, 2016 5:48 PM in response to PeterBreis0807

When you say, "First step is always to find and mark the paragraph returns, which are usually 2 returns. Mark those with a unique replacement, I usually use <#>," I presume you are referring to a specific application with this feature capability. I am unfamiliar with replacing text nor does the value of doing this make sense to me. If I am able to replace a specific condition with a symbol, why not replace it with the format I seek instead? Please could you clarify?


Thanks

Dec 12, 2016 7:12 PM in response to Skyeword

I can't see the text, but it sounds like you may have messed up the original in your attempts to clean it up.


Normally you can differentiate between line feeds and returns or get them from formatting habits.


Also it usually pays not to work directly from HTML but from the text as shown in a browser, which is cleaner when copied and can be pasted without formatting.


I would be using a TextEditor such as BBedit or TextWrangler, both of which use GREP, for cleaning up the text.


The current version of Pages is awful for Find and Replace. Pages '09 is better but still requires multiple manual sweeps.


Peter

Dec 12, 2016 7:21 PM in response to Skyeword

Skyeword wrote:


When you say, "First step is always to find and mark the paragraph returns, which are usually 2 returns. Mark those with a unique replacement, I usually use <#>," I presume you are referring to a specific application with this feature capability. I am unfamiliar with replacing text nor does the value of doing this make sense to me. If I am able to replace a specific condition with a symbol, why not replace it with the format I seek instead? Please could you clarify?


Thanks


No. It is simply a temporary marker, in any old App, to distinguish the ends of paragraphs from line feeds.


First sweep you find the ends of paragraphs (usually typed with 2 returns), which you replace with the marker that can be anything but <#> is unique.


Second sweep you replace all the single returns at the ends of lines with single word spaces. If you hadn't replaced the double end returns, those would also become word spaces.


Third sweep you find all the <#> markers and replace them with single returns.


You need a lot more clean up usually.


Multiple wordspaces and tabs, spaces before punctuation and at the beginnings of paragraphs, etc.


It's basic systematic logic. Look for patterns, bad habits, and replace them in either one or two steps.


Peter

Dec 12, 2016 10:32 PM in response to PeterBreis0807

So you've made an assumption and told me what not to do though not offered any further insights on what your words mean? Why would you do that? Padding your stats? Was your first answer from a user guide though not from personal experience? If I wanted to flatline 1,300 pages and turn it all to simple text, I cold easily have done that. The softwares you mention are primarily for HTML and GREP is some cryptic tool for folks I presume that interact with HTML formatted text. I looked it up on Wiki and still do not understand how that solves my specific problem.. I've been using Macs professionally since 1989 and from this vast experience I know enough to use Simple Text to clear all formatting, but this is not what I seek and I made that clear. 1,300 pages of text that requires individual formatting is far more work than manually deleting soft returns of formatted text. Jeeeez man!

How do I delete blank lines using search and replace

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.