Re: Search & Replace multiple Paragraph returns
Re: Search & Replace multiple Paragraph returns
- Subject: Re: Search & Replace multiple Paragraph returns
- From: Barry Wainwright <email@hidden>
- Date: Thu, 09 Jun 2005 10:17:13 +0100
- Thread-topic: Search & Replace multiple Paragraph returns
On 9/6/05 08:31, "Barry Wainwright" <email@hidden> wrote:
> On 8/6/05 19:12, "doug rogers" <email@hidden> wrote:
>
>> I have a Search and Replace handler from
>> <http://bbs.applescript.net/viewtopic.php?id=11449> that I should be
>> able to use. I want to replace multiple paragraph returns in a variable
>> with just a single return. To set the value of the search and replace
>> string, I have copied them out of the original text window. The handle
>> returns the same text I load into the variable, and Hog Bay Notebook
>> returns the error that it can't continue SearchReplaceText.
>
> Without OSAXen:
>
> set theText to "this is some text
> with paragraphs
> and with
>
> double paragraphs
> as
>
> well
> "
>
> do shell script "echo " & quoted form of theText & "|tr -s " & ¬
> quoted form of (return & return)
>
> If 'thetext' gets to be longer than about 64k you will have to write it to a
> disk file first then pass that file through the 'tr' filter
Oops - silly me.
Don't need that double return in 'tr' - make the last line like this:
do shell script "echo " & quoted form of theText & "|tr -s " & return
--
Barry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden