shell-perl problems
shell-perl problems
- Subject: shell-perl problems
- From: John Fowler <email@hidden>
- Date: Sat, 20 Dec 2003 00:17:10 -0600
Dear fellow scripters,
I am trying to write a script to "find" using regular expressions via
perl.
My handler so far:
set thestring to "DOCTYPE(.*)PUBLIC" --for example, just a test string
perlregexfind(theText, thestring)
on perlregexfind(theText, thestring)
try
set theResult to (do shell script "/usr/bin/perl -e '$thisvar=\"" &
(theText) & "\";$thisvar=~m/" & thestring & "/;print $1'")
--set theResult to (do shell script "echo " & quoted form of theText)
return theResult
on error thiserror
return thiserror
end try
end perlregexfind
When I submit a fairly straightforward text bite as theText, this
script seems to return the desired result. When I input a large block
of text downloaded (a web page), I get
"sh: -c: line 1: syntax error near unexpected token `<'
sh: -c: line 1: `/usr/bin/perl -e '$thisvar=\"<!DOCTYPE H....
I tried using "quoted form of theText" in the set theResult line
without improving the situation.
Can anybody point me in the right direction?
John Fowler
PS on the web page
http://developer.apple.com/technotes/tn2002/tn2065.html, perl is called
with a -n thingie as well as a -e thingie. What does the -n do?
(Putting it into my script didn't help).
Thanks
JF
_______________________________________________
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.