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

Apr 24, 2015 10:17 AM in response to Michael Donahue1

Lets assume Pages v5.5.3 on your Yosemite. From your Pages View menu, Show Invisibles. This will show the hard and soft returns that appear to comprise those blank lines in your document. Let's deal with the hard returns first. By example the following has a single blank line between each character:

User uploaded file

Select the pilcrow below the A, and the one immediately behind the A. Then, in you would press command+E to use these two pilcrow character selections for your Find. The command+E is a shortcut from the Edit ▸ Find ▸ Use Selection for Find menu item. Now, just select the pilcrow behind the A, and choose Edit ▸ Find ▸ Use Selection for Replace. In short, we are replacing two pilcrow with a single pilcrow that will collapse the blank lines.


Press command+F, or Edit ▸ Find ▸ Find… , and your Find and Replace fields are pre-filled from the previous paragraph. Your find field will also report how many double-pilcrow matches it found. Then click Replace All. The result looks like the following:

User uploaded file

What if you have a mixture of hard (pilcrow) and soft (carriage ↵ ) returns that looks like the following:

User uploaded file

You would perform paragraph two again, this time selecting the carriage return behind the A, and the next pilcrow, followed by command+E. Then just select a single pilcrow for your replace sequence. Command+F, and replace all. This will leave you with the following, and for that extra hard (pilcrow) return in it, you now know how to remove it too.

User uploaded file

Jul 7, 2015 8:05 AM in response to VikingOSX

This was really helpful — the issue was driving me nuts, as each day I have to copy from the web and paste into Pages and remove (until now, manually) hundreds of paragraph breaks. I knew how to show invisibles, and I was trying manually to copy them and paste into the Find/Replace box, but this just doesn't work. So counter-intuitive. I really appreciate the help, and am surprised at Apple. It took me a long time to track down this thread. Thanks.

Nov 5, 2016 11:00 AM in response to tommybanana

Pressing command-e on a selection does absolutely nothing that you can see, but it does advance populate the Find field before you launch the Find interface. You then must select a replacement character, using one of these:

  1. Select, and then apply Edit menu : Find : Use Selection for Replace.
  2. Select, and then copy/paste into Replace field of the Find dialog.
  3. Direct enter Replace character(s) in the Replace field.


Sometimes, it is beneficial to select Whole Words from the Find panel gear icon.


It is insufficient to tell us that something did not work. Tell us a story about what you want to achieve with Find/Replace, what specifically is/are the individual find and replace character(s). Help us to help you.

Dec 10, 2016 5:47 AM in response to PeterBreis0807

Kitten is correct. 5.6.2 only marginally allows for the copy and replacement of invisibles. I have a 1,300 page document and am unable to use Find / Replace, Copy / Paste Styles, Create a Style etc. to deal with the removal of simple carriage returns en masse having converted HTML to plain text.


It seems incredibly backwards to progressively limit this feature so I will assume that nobody in this thread knows where Apple hid the solution which is so often the case... I am able to find and delete one line at a time, but perhaps you missed the 1,300 pages bit! Why not allow 'Styles to recognize carriage returns?


The trouble is that there are returns inside the paragraphs as well the need to add hard returns between paragraphs. I suspect adding a return en masse is impossible, but the simple internal return deletions MUST be possible even if only one paragraph at a time, although, did I mention 1,300 pages, 1,340 to be precise?


A solution would be appreciated.

Dec 10, 2016 6:50 AM in response to Skyeword

So what is the pattern?


A hard return at the end of each line, or a soft return (a line feed), which needs to be replaced with a space?


Two returns at the end of each paragraph?


If you have this then it can be fixed but you also probably need to do a whole lot more cleaning up of the text. Bad spacing, punctuation, tabs, capitalisation etc.


No way would I do it in Pages simply because it is not built for large amounts of text.


Where has this text come from?


What format is it in?


What is the end result you wish to achieve?


Peter

Dec 10, 2016 7:01 AM in response to PeterBreis0807

Soft Returns at the end of each line. I'm manually adding a hard return between paragraphs currently.


I have tried Clean Text, Libre Office and Word with less success than Pages.


The text was originally HTML and has been substantially cleaned up. I made a short screenview video but the insert video directly above in this window is greyed....


End result is a legible document with proper paragraph spacing and preferably no spaces, as well a space between major paragraphs (which I suspect must be achieved manually).


Thanks Peter...

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.