• 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: Native AS or grep via do shell script?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Native AS or grep via do shell script?


  • Subject: Re: Native AS or grep via do shell script?
  • From: Christopher Nebel <email@hidden>
  • Date: Mon, 1 Nov 2004 13:41:07 -0800

On Oct 30, 2004, at 9:17 PM, Joseph Weaks wrote:

On Oct 29, 2004, at 5:39 PM, Christopher Nebel wrote:
Trying to use Perl without understanding what you're doing is generally considered a bad idea.

Do we really need to read a whole Perl intro to learn how to use it for text manipulation in do shell script calls?

Of course not -- very few people actually understand *all* of Perl. You should, however, understand the parts you're trying to use: in this case, the -n and -p command-line switches, when you need the "g", "s", and "m" pattern modifiers, how to use assertions correctly, and so on.


I want to be able to write for myself these kinds of handlers that will take a string or an alias using calls to Perl:

replaceFirstOccurrence(theString, toFind, toReplace)

replaceEveryOccurence(theString, toFind, toReplace)

replaceTextBetweenTwoStrings((theString, theStart, theEnd, toReplace)

returnListOfEveryStringBetweenTheseTwoTags(theString, theStart, theEnd, toReplace)

I'd like to learn Perl's Reg Ex enough to write lines that will find more dynamic matches, as well.
What should I be reading to reach the goal?

Personally, I still go for Programming Perl (3rd ed.) -- chapter 5 covers pattern matching. Depending on your learning style, you may find yourself better served by something like Learning Perl or the Perl Cookbook (all from O'Reilly).



--Chris Nebel AppleScript Engineering _______________________________________________ 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
  • Prev by Date: Bridge anyone? [not off topic]
  • Next by Date: iTunes questions ( not specifically scripting, so slightly OT )
  • Previous by thread: Re: Bridge anyone? [not off topic]
  • Next by thread: iTunes questions ( not specifically scripting, so slightly OT )
  • Index(es):
    • Date
    • Thread