• 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: Jakob Peterhänsel <email@hidden>
  • Date: Wed, 27 Oct 2004 12:00:21 +0200

Hi all,

Guess I have to answer this myself...

If the text in the emails had been consistent, AS could have done the job, but it's not stable enough.
Grep to the rescue.

set "[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]"

In order to get the stdout from the CLI, it seems we have to use 'echo', and then pipe the variable data to grep:

set (do shell script "echo " & quoted form & " | grep -e '" & & "'") text

Consider the mailbody below, it will give us back a two-line reply:
-> "02-10-2004 00:00
02-10-2004 06:00"

For some reason, we can't do:

set "02-10-2004 00:00" date

But, this seems to work:
set "02-10-2004 00:00"
( )



Now, if only the CLI grep was as flexible as the one in BBEdit... :-/



<x-tad-smaller>____________________________________________
</x-tad-smaller>Jakob Peterhänsel
Network Consultant
<x-tad-smaller>Tel: +45 7022 1014</x-tad-smaller>
<x-tad-smaller>Fax: +45 7022 1013</x-tad-smaller>
<x-tad-smaller>Mob: +45 22 68 49 61
</x-tad-smaller><x-tad-smaller>email@hidden</x-tad-smaller>

<x-tad-smaller>www.NetPoint.com
</x-tad-smaller>


On 25. okt 2004, at 15:11, Jakob Peterhänsel wrote:

Hi All, I have some messages coming in via Mail.app that I woudl like to process, parse and create entries in iCal for.
As they are not that structured, I would like to ask how the gurus on this list would handle this: Native in AppleScript, or via grep/do shell script?

The messages body looks something like this:
---------------------------------------------------------------------------------------------------------
For at sikre stabil liniedrift, foretager vi med kort varsel en kritisk opgradering i følgende område:

Hele landet

Der vil blive foretaget en kritisk software opgradering i tidrummet mellem 0:00 og 6:00

I perioden:
02-10-2004 00:00
til
02-10-2004 06:00

Følgende platforme vil blive berørt:
VPN, Medarbejderbredbånd, Data/Internet

Vi beklager de gener, dette måtte medføre.

---------------------------------------------------------------------------------------------------------

I would like to get the two dates, if they exists, the line with "Hele Landet" and the line starting with "VPN, Medarbejderbredbånd...."

Any clues?


<x-tad-smaller>____________________________________________
</x-tad-smaller>Jakob Peterhänsel
Network Consultant
<x-tad-smaller>Tel: +45 7022 1014</x-tad-smaller>
<x-tad-smaller>Fax: +45 7022 1013</x-tad-smaller>
<x-tad-smaller>Mob: +45 22 68 49 61
</x-tad-smaller><x-tad-smaller>email@hidden</x-tad-smaller>

<x-tad-smaller>www.NetPoint.com
</x-tad-smaller>

_______________________________________________
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
 _______________________________________________
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: Christopher Nebel <email@hidden>
    • Re: Native AS or grep via do shell script?
      • From: Eric Geoffroy <email@hidden>
References: 
 >Native AS or grep via do shell script? (From: Jakob Peterhänsel <email@hidden>)

  • Prev by Date: Re: Applescript, VectorScript & VectorWorks
  • Next by Date: re: Code Completion suggestion
  • Previous by thread: Native AS or grep via do shell script?
  • Next by thread: Re: Native AS or grep via do shell script?
  • Index(es):
    • Date
    • Thread