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:
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 17 Sep 2009 13:13:24 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (30 lines)
Just when I thought I'd figured this out...

I'm trying to find every line in a 2800-line pipe delimited file that  
contains: |(TRAV)|

This lines in the file looks something like this:
--11:00 pm|(TOON)|LOG|Robot Chicken|<snip>
--11:00 pm|(TRAV)|LOG|Most Haunted USA|<snip>

I've tried numerous variations of escaping and not escaping  
characters, but I haven't stumbled upon the right combination.

The version below returns every line of the file.

Any suggestions?

set mLogFile to POSIX path of mLogFile
set channelID to "(TRAV)"

set thePattern to channelID
set thePattern to "\\|" & channelID & "\\||"
--set myShellScript to "egrep " & thePattern & " " & quoted form of  
mLogFile
set myShellScript to "egrep " & quoted form of thePattern & " " &  
quoted form of mLogFile
set mySchedule to do shell script myShellScript
return mySchedule

ES

ATOM RSS1 RSS2