Re: Perl grep from AppleScript

2003-03-26 Thread Chris Nandor
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Christopher Stone) wrote:

> I used to use the RegEx osax for a huge number of tasks, but it hasn't been 
> ported to X nor will it ever be.
> 
> So, that being the case I have to break down and learn Perl...  :)
> 
> This rank newbie needs a template for using perl grep from AppleScript.

FWIW: you use grep in perl to loop over the elements of a list, performing 
some action (usually matching) against each one, and returning the ones that 
match.  So you probably don't mean "grep" here.


> What I want to do is provide input from an AppleScript variable; grab the 
> pattern I want with perl; and output to an AppleScript variable.

   do shell script "perl -e '$x = shift; $x =~ /(.pat.)/; print $1' spatter"
   > "spatt"

Hope that helps,

-- 
Chris Nandor  [EMAIL PROTECTED]http://pudge.net/
Open Source Development Network[EMAIL PROTECTED] http://osdn.com/


Perl grep from AppleScript

2003-03-26 Thread Christopher Stone
Greetings,

I'm a recent convert to Mac OS X.

I used to use the RegEx osax for a huge number of tasks, but it hasn't been ported to 
X nor will it ever be.

So, that being the case I have to break down and learn Perl...  :)

This rank newbie needs a template for using perl grep from AppleScript.

What I want to do is provide input from an AppleScript variable; grab the pattern I 
want with perl; and output to an AppleScript variable.

If someone could help me out I'd be most appreciative; the unixy bits have still got 
me a trifle flummoxed.

Thanks.
  

Best Regards,

Chris