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

Advanced Find and Replace. How to replace space with carriage return?

10.9.13.0/24, 10.9.4.2/32, 10.9.4.3/32



into


10.9.13.0/24
10.9.4.2/32
10.9.4.3/32



Find replace ", " with carriage return.


I keep find articles about an advanced find and replace but I can't seem to locate it.


OS X El Capitan 10.11.3

Numbers 3.6.1

Posted on Feb 8, 2016 4:45 PM

Reply
Question marked as Best reply

Posted on Jul 30, 2017 10:50 PM

Hi tagprez,


Good call.

For those who don't like "Use Selection for Find/Replace" but prefer to type a code, Numbers and Pages uses \n for a carriage return (newline).


Replacing comma space with newline:

User uploaded file

Replace All

User uploaded file


Regards,

Ian.

17 replies

Aug 25, 2016 6:52 PM in response to SGIII

I THINK I understand what is being said here. Please tell me if this is correct -- I tried it and this was the only thing that actually worked.

I have a lot of names separated by Comma-Space and I want a list of names separated by CarriageReturns [CR].


I'm using Pages 5.6.2 on a brand new iMac. The Find-and-Replace in PAGES does not allow for the pasting of a CR into the replacement field; and the Edit>Find>UseSelectionForReplace menu item does not work. So in order to do my replacement I need to SelectAll and Copy; then open NUMBERS and find an empty cell to Paste into. Then use the Find-and-Replace in NUMBERS to make the replacements (although the CR symbols are invisible). THEN SelectAll and Copy from that cell, switch back to Pages and Paste the text into the original document.


REALLY?

There's not a way to do that directly in Pages? Boggles my mind.

Aug 25, 2016 7:12 PM in response to KittenPetter

KittenPetter wrote:


I have a lot of names separated by Comma-Space and I want a list of names separated by CarriageReturns [CR].



One of the easiest ways is to use a simple script. Just select, copy, click, and copy-paste. No need to know AppleScript to use. A few seconds and you're done.


  1. Copy-paste script below into Script Editor (in Applications > Utilities)
  2. Select the comma space-separated names and command-c to copy them to the clipboard.
  3. Click the triangle 'run' button in Script Editor.
  4. Click in Pages (or wherever you want the list) and command-v to paste.


(If you've not run a script on your machine before yyou may need to make sure Script Editor is checked at System Preferences > Security & Privacy > Privacy > Accessibility.)


SG


(*

converts text in form of name1, name2, name3, name 4

to:

name1

name2

name3

etc.

*)


set inText to the clipboardastext

set text item delimiters to ", "

set tempList to inText'stext items

set text item delimiters to return

set outText to tempList as text

set the clipboard tooutText

display notification "Click somewhere and command-v to paste"

Advanced Find and Replace. How to replace space with carriage return?

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