Re: Insert Text Here
Re: Insert Text Here
- Subject: Re: Insert Text Here
- From: Christopher Stone <email@hidden>
- Date: Sun, 22 Jan 2012 04:33:15 -0600
On Jan 22, 2012, at 04:18, David Ferrington wrote: Why not use sed to make a simple substitution of a known text string. My A/S is not good, but the unix sed command to do that is :
... sed will put the text out to stdout, so you need to buffer it if you want to redirect, hence copy your file to another temp file and then use that as the source of the file to be changed.
______________________________________________________________________
sed can work on a file in-place using the -i switch.
Jon's SmartString object is nice too, but I generally prefer using the Satimage.osax for find/replace. It can operate on a text variable, a list variable, and a file in-place.
set someText to "Now is the time for all good men to come to the aid of their country."
change "Now is" into "Then was" in someText
change "the\\w*" into "•••" in someText with regexp
change "the\\w*" into "•••" in someFileAlias with regexp
-- Best Regards, Chris
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden