• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Insert Text Here
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Insert Text Here
      • From: David Ferrington <email@hidden>
References: 
 >Insert Text Here (From: Marconi <email@hidden>)
 >Re: Insert Text Here (From: Jon Pugh <email@hidden>)
 >Re: Insert Text Here (From: David Ferrington <email@hidden>)

  • Prev by Date: Re: Insert Text Here
  • Next by Date: Re: Insert Text Here
  • Previous by thread: Re: Insert Text Here
  • Next by thread: Re: Insert Text Here
  • Index(es):
    • Date
    • Thread