Re: text item delimiter-resolved.
Re: text item delimiter-resolved.
- Subject: Re: text item delimiter-resolved.
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 2 May 2005 10:32:28 -0400
On 5/2/05, Gnarlodious <email@hidden> wrote:
Entity Ruby Madraswala spoke thus:
> I did get quite a few suggestions to use ³sed², that¹s so new for me. I did
> not find any reference to this command in Applescript The Definitive Guide
> book. Is this new or you just know by experience?
sed (the name stands for Stream EDitor) s a UNIX shell command, so from
the Macintosh viewpoint, it's new as of OS X. But it was the
second non-interactive text manipulation tool created in the UNIX world
(the first was grep), and dates to sometime back in the early
1970s.
Anything you accomplish with "do shell script" from AppleScript is
really a UNIX command (which means you can also type it directly in a
Terminal window), not anything built in to AppleScript itself.
Both grep and sed are based on the interactive text editor "ed", which
is very powerful, but makes vi seem intuitive by comparison. :)
It's not that it's flawed, though, just dated - there was no such thing
as full-screen editing, much less GUIs, when it was invented; it was
designed to be used over a teletype at speeds that make 300baud look
downright zippy. So the way it works is this: you load a file
(which you can't see on your screen). You type a command to find
and display just the lines you care about, and then type more commands
to change them, and every once in a while type a command to redisplay
them to make sure you got the changes right. :) Since this is a
tedious procedure, the commands themselves are incredibly powerful,
designed to give you the most bang for the buck in terms of changes per
typed character. It's simply phenomenal the sorts of things you
can do to text with a single terse (and therefore cryptic) ed command;
it's a shame that /usr/games/quiz doesn't seem to be part of OS X,
cause "quiz function ed-command" is a great demonstration of its
power. But the fact that regular expressions are used
anywhere outside of compilers and computer science theory classes, and
the availability of complex powertools in modern editors like BBEdit,
can be traced back to ed.
When did "do shell script" get introduced into AppleScript, anyway? Was that new in Panther?
--
Mark J. Reed <
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