thanks Chris, for a lovely explanation. This is the kind of explanation 
us MacOS-newbies understand. You should write a" Perl for MacOS X" book 
in the tradition of Randal's llama book. I'll buy it.

Btw, one quickie --

> move the LWP head to a better name, let's say /usr/bin/lwp-head

by LWP head, I am assuming you are referring to HEAD, no?

pk/




On Wednesday, April 3, 2002, at 09:04  AM, Chris Devers wrote:

> On Wed, 3 Apr 2002, Puneet Kishor wrote:
>
>> Question -- if/when I do find head on the OS X CD, where should I put
>> it? I can't put it back in /usr/bin because it will then overwrite HEAD
>> that is present there now, no?
>
>  * Find it on the CD, let's say it's at /Volumes/MacOSX/usr/bin/head
>  * move the LWP head to a better name, let's say /usr/bin/lwp-head
>  * copy /Volumes/MacOSX/usr/bin/head to /usr/bin/head
>
> System restored, conflict resolved.
>
>> corollary -- why is head so important?
>
> It's useful for viewing slices of an input stream or file. Yes it is the
> opposite of tail, and in tandem the two can help solve problems like, 
> say,
> (contrived example) finding the median sized file in a directory:
>
>   % ls -s1 | sort | wc -l
>       51
>   % ls -s1 | sort | head -26 | tail -1
>    42 echelon_terms
>   %
>
> Yes that's kind of an exotic example, but it's the first one that comes 
> to
> mind that shows how you can pass output from head (the first subset of a
> list of lines) to tail (to get the last sub-subset of the head list) in
> order to slice into the middle of a larger set.
>
> Plus, more simply, they're just not the same. /usr/bin/head gives you 
> the
> beginning of input; /usr/bin/tail gives you the end of input. They are
> complementary, yes, but they do have different roles & uses.
>
> Anyway, if you're not normally slicing & dicing files & streams, then 
> you
> can probably live without filters like this, but they can be very useful
> if you know how to manipulate them. And as you point out, even if you
> don't use them directly, other applications might assume that the tools
> are available & fail if they're not. So it's worth fixing.
>
>
>
> --
> Chris Devers                                [EMAIL PROTECTED]
> Apache / mod_perl / http://homepage.mac.com/chdevers/resume/
>
> "More war soon. You know how it is."    -- mnftiu.cc
>

Reply via email to