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:
"Mark J. Reed" <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 17 Sep 2009 20:48:28 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (20 lines)
On Thu, Sep 17, 2009 at 8:14 PM, [log in to unmask] <[log in to unmask]> wrote:
> I'm thinking there's a way to run tr on a file, have the result
> in memory, then egrep that to get the desired results, but I'm not there
> yet.

That'd be a "pipe".  And tr and egrep run in parallel, so there's no
delay and no need for a big memory buffer.  tr writes a line of
output, egrep reads a line of input, repeat.


do shell script "tr '\\r' '\\n' " & quoted form of pathName & " |
egrep " & quoted form of regExp

Note that you just don't supply a filename to egrep at all; it
automatically reads from its standard input in that case, which the
shell has attached to the pipe.

-- 
Mark J. Reed <[log in to unmask]>

ATOM RSS1 RSS2