• 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: Fri, 29 Oct 2004 15:39:42 -0700

On Oct 29, 2004, at 3:43 AM, Jakob Peterhänsel wrote:

That perl stuff seems to work, but I can't get it to return stuff where the matching is over multiple lines.
Consider the text:
------Email Body--------------
Entry text line here:

Area Discription

In periode from
dd-mm-yyyy hh:mm
to
dd-mm-yyyy hh:mm

Bla.. bla...
-------Email body end---------

Now this code works fine:
set "perl -ne 'print if s/(Are\\w+)/$1/;'"
set do shell script "echo " & quoted form & " | " & cliCmd
--> Area Discription


If I introduce some newline matching, it fails, like:
set "perl -ne 'print if s/\\r(\\w+)/$1/;'"

I'm really puzzled over this, as the perlre man-page say's it should be working. Even using \n gives the same no-match.

Naturally. -n implicitly handles your input one line at a time. Go read perlrun(1). If you want multi-line matches, you'll have to drop the -n and gather all the input first, perhaps like this:

$_ = join "", <>;

Trying to use Perl without understanding what you're doing is generally considered a bad idea.


--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

  • Follow-Ups:
    • Re: Native AS or grep via do shell script?
      • From: Joseph Weaks <email@hidden>
    • Re: Native AS or grep via do shell script?
      • From: Dave Balderstone <email@hidden>
    • Re: Native AS or grep via do shell script?
      • From: "John W. Baxter" <email@hidden>
References: 
 >Native AS or grep via do shell script? (From: Jakob Peterhänsel <email@hidden>)
 >Re: Native AS or grep via do shell script? (From: Jakob Peterhänsel <email@hidden>)
 >Re: Native AS or grep via do shell script? (From: Christopher Nebel <email@hidden>)
 >Re: Native AS or grep via do shell script? (From: Jakob Peterhänsel <email@hidden>)

  • Prev by Date: Re: [OT] Typo, someone was asking?
  • Next by Date: Re: disable AppleScript in OS X?
  • Previous by thread: Re: Native AS or grep via do shell script?
  • Next by thread: Re: Native AS or grep via do shell script?
  • Index(es):
    • Date
    • Thread