Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Search & Replace multiple Paragraph returns



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

-- 
Barry




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.