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
17 replies

Feb 9, 2016 1:55 AM in response to BrendonD

Hi Brendon,


In Numbers 3, click on the View button in the ToolBar

User uploaded file

Choose Show Find & Replace

User uploaded file

In the Find box, type comma space.

Insert a text box and type a single return character (press the enter key) and select that return.

User uploaded file

Menu > Edit > Find > Use Selection for Replace

User uploaded file

The return doesn't show, but it is there in the Replace box.

Click on Replace All to replace every occurrence in that document.

From Numbers Help: Find and Replace Text:

User uploaded file

User uploaded file


Regards,

Ian.

Feb 9, 2016 7:09 PM in response to BrendonD

BrendonD wrote:


unfortunately again this has not worked. The carriage return, appearing in the text box exactly as in your steps, translates into a space in the replace window. Then when the replace all function is used, a space not carriage return is added in substitute.



Hi Brendon,


It took me a while figure out what I was missing, but Ian's method definitely works here in v. 3.6.1. Here's what worked:


  1. Type , followed by a space in the first box in 'Find & Replace' dialog.
  2. Create a text box by clicking the icon in the toolbar, type return once to put the focus in the new text box, and another return to put an invisible return character in it. Then select the entire contents (two lines consisting of one invisible character) of the text box (I typed command-a to do this).
  3. With the contents of the text box selected, in the menu Go to Edit > Find and choose 'Use Selection for Replace'
  4. Click 'Replace All' in the 'Find & Replace' dialog.


SG

Feb 8, 2016 6:13 PM in response to BrendonD

Hi Brendon,


Correct. Any combination of keystrokes separated by hyphens means "Press and hold all keys except the last in the list, then tap the last key, then release all."


Other examples:

shift-command-3 (takes a screen shot and saves it as a file on the desktop)

shift-command-4 (changes the mouse pointer to a cross hair, with which you can select a portion of the screen. Takes a screen shot of the enclosed area when the mouse in released, and saves it as a file on the desktop.

shift-control-command-3

shift-control-command-4 These take the screen shots described above, but place the result on the Clipboard, not in a file.


option-return or option-tab should place a return (or tab) into the Find or Replace box depending where you have the insertion point. You should see a Pilcrow symbol ( ¶ ) in the box. Example below (in Numbers '09).

User uploaded file


Regards,

Barry

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"

Feb 8, 2016 6:21 PM in response to Barry

Hi Barry,


Unfortunately you will find that this does not work in Numbers 3.6.1. It seems that sometime round 2010 Apple removed the advanced find and replace axing the use of reg expressions and other features other than basic string replacement.


Even though the option-return works inside a cell it is not a valid entry in the replace field under 3.6.1.


I have since copied my data to excel and used VBA code to implement the change before bringing it back. Of course if someone does figure out a way to do this in Numbers that'd be swell.


Regards,

Brendon

Feb 9, 2016 2:56 PM in response to Yellowbox

Hi Ian,


I appreciate the detail of your response, unfortunately again this has not worked. The carriage return, appearing in the text box exactly as in your steps, translates into a space in the replace window. Then when the replace all function is used, a space not carriage return is added in substitute.


I'd like to think this issue isn't specific to my computer but logically this may be the case if the above steps perform as advertised on another with the same 3.6.1 version of numbers.


Regards,

Brendon

Feb 9, 2016 5:09 PM in response to BrendonD

It happens that I just spent an hour devising various futile approaches to substituting spaces for carriage returns in a Pages document. They included all the tricks described above. What's most frustrating is that on my older iBook, AppleWorks does this routinely. I believe \p represents the carriage return, or you can type one and copy it. Unhappily, Apple's attempts to gussy up their apps don't include leaving the good parts alone, or in AppleWorks' case, not tinkering with it at all.

Feb 9, 2016 7:28 PM in response to SGIII

I can verify that, as obtuse and counter-intuitive it is (to say nothing of profoundly un-Apple-like), SGIII's procedure does actually work. Quite consistently, in my experience. I had to learn this unpleasantry a few days ago. Ugh.


Its clumsiness is so bad it almost disappoints me that it works, but... well, Bob's your uncle. In this case, Bob is an overweight heavy drinker who doesn't use deodorant, but he does actually do his job.

Mar 9, 2016 5:17 AM in response to macmikey

I'm with macmikey on this - although it does work it is horribly frustrating and one of the best reasons not to use Pages. The idea that you can functionally track so much detail required to control all three variables here: the scope of your find/replace, the find characters and the replace characters is utterly ridiculous when the software does not show you what the heck is happening as it is happening. To me the idea of "invisibles" in a word processor is frankly arrogant and insulting. I use MS-Word for OSX because it is a huge time saver. That product shows you what you need to see to easily control all of the variables. And you'll not need to resort to reading forums to figure things out.

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.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

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 Account.