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

How to create an "ENTER-action in text" in Automator

Hi,


I have the following challenge here:


I have text content that consists of several weblinks without a space in between. It looks like this:


http://www.gooogl.com/https://abc.org/http://banana.com/http://skydive.net/ etc.


What I'd like to do in Automator is to create an action that enters a new paragraph ahead of every address, so that it will finally look like this:


http://www.gooogl.com/

https://abc.org/

http://banana.com/

http://skydive.net/


I hope you get the idea :-)


My text input will be in pages, but if that doesn't work than I switch to TextEdit.


So, how do I do this? Right now I enter the paragraphs manually but this text has several hundreds of lines.


Appreciate your help.


Thanks,

Mike

MacBook Pro, OS X Mavericks (10.9.4), Automator

Posted on Jul 19, 2014 1:10 PM

Reply
1 reply

Jul 19, 2014 3:26 PM in response to michaelsopa

Hello


You may create an Automator service as follows:


Automator Service:

Service receives selected [text] in [any application],

Replaces selected text [checked]


Workflow:

Action = Run Shell Script action

Shell = /bin/bash

Pass input = to stdin

Code =

/usr/bin/perl -CSDA -pe 's%.(?=https?://)%$&\n%og;'



Service workflow will look like this:


User uploaded file



To use it, select text and invoke service (from Services menu or keyboard shortcut you assigned) and it will replace the selected text with the processed text.



Hope this may help,

H

How to create an "ENTER-action in text" in Automator

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