MACSCRPT Archives

September 2009

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ed Stockly <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 10 Sep 2009 20:31:05 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (24 lines)
Thanks for the help, this is what I ended up using:

set myShell to "egrep '^(696\\||873\\||981\\|)' " & quoted form of myFile

It works, and I think I even know why.

The \| is used by the shell to indicate a pipe is part of the string, right? With out it 
numbers like 696123| would also be returned (the \\ is needed to tell applescript that \ is 
part of the shell script)

The second | is used as an or , right? Which allows me to send multiple strings in the 
same egrep command.

As for efficiency, it takes about 7 seconds to search an entire file returning a few hundred 
matches to a single pattern and it take about 7 seconds to search an entire file returning 
a few thousand matches to 100+ patterns.

So now I will write the results to a new file, then grep a pattern from that file that 
matches the third delimited item.

Piece of cake, right?

ES

ATOM RSS1 RSS2