• 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
String replacement or How I stopped Worrying and learned to Love Perl
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

String replacement or How I stopped Worrying and learned to Love Perl


  • Subject: String replacement or How I stopped Worrying and learned to Love Perl
  • From: Daniel Lord <email@hidden>
  • Date: Tue, 14 Jan 2003 22:22:58 -0800

Folks,
Rather than contort Applescript into doing unnatural things let it do
what it does best and use Perl for what it does best as I have learned
to do:

set regexp to "'s/\\.util//g;print;'"
set s to
"Gnarlodious.util:Workshop.util:Forth.util:Mops.util:MopsManual.util:"
set shellCmd to "echo " & s & " | perl -ne " & regexp
set x to do shell script shellCmd

Works every time ;-) And better yet you can use very complex regex
subs and even match variables like \1 \2 etc. I even wrote a recursive
file renamer and mover using a Python script to do the regex and
recursive directory walking and wrapping it in Applescript Studio to
provide a GUI. The combination Python-AS was much faster than doing it
all in Applescript alone. Only on OS X can you do this and that is its
true power.

Daniel Lord
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: open for access file pathstring with write permission
  • Next by Date: FileMaker not responding to AS in 9.2
  • Previous by thread: Re: fonts query
  • Next by thread: FileMaker not responding to AS in 9.2
  • Index(es):
    • Date
    • Thread