Re: Search a file question - Mac OS 9
Re: Search a file question - Mac OS 9
- Subject: Re: Search a file question - Mac OS 9
- From: bill fancher <email@hidden>
- Date: Wed, 18 Sep 2002 10:11:34 -0700
On Tuesday, September 17, 2002, at 02:08 PM, Arthur J. Knapp wrote:
Date: Tue, 17 Sep 2002 12:18:04 -0700
Subject: Re: Search a file question - Mac OS 9
From: bill fancher <email@hidden>
On Tuesday, September 17, 2002, at 11:21 AM, bill fancher wrote:
do shell script "grep -n 'RC \\[[1-9][0-9]*\\]' /path/to/input >
/path/to/output"
You can pipe that through something else if you need to tweak the
output format. Let us know...
Some people don't even bother to read the whole subject line.
Regardless of the subject line, I'm not sure that this is the right
way to answer someone's question in any case. We might as well respond
to ALL questions on this mailing list like this:
do shell script "use unix/perl/shell commands, you silly person."
I posted a script that does everything he asked. It's complete and
tested. It requires only the wit to replace "/path/to/input" with
something appropriate.
Your reply to the original poster did nothing more, though your script
was 13 times as long. (It seemingly did less: You implied that your
script would only work with files < 32k. I didn't verify that.)
He didn't specify an output format. The script I posted produces lines
like "5:There was an RC [234567] error processing file...". Not knowing
whether that was satisfactory (maybe he wants a tab instead of a colon,
maybe he doesn't care), I indicated that it could easily be tweaked (by
piping through another command, a technique well worth mastering) and
implicitly offered to help should that be necessary.
There's nothing mysterious about grep's syntax. It's the same as that
of the LNS Regular Expression osax, and any number of other regular
expression implementations. From the docs for the Regular Expression
osax: "For a description of the syntax of pattern strings see the
documentation accompanying the LNS Scripting Additions, or for the UNIX
grep command." I don't recall any public outcry when the osax was
released or when people posted scripts using it.
;-)
Pipe THAT through something else and let me know what you think.
;-)
I think I've offended you (smileys notwithstanding). I'm not sure how.
--
bill
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.