Re: Attempt #3, adding a new command 'sfilter'

From: Garance A Drosehn <gad_at_FreeBSD.org>
Date: Wed, 6 Sep 2006 22:00:30 -0400
At 9:54 PM -0300 9/6/06, Ricardo Nabinger Sanchez wrote:
>
>On Wed, 6 Sep 2006, Garance A Drosehn <gad_at_FreeBSD.org> wrote:
>
>>  Actually, I have another useful option in mind that could be added
>>  with very little effort.  So let me say that I do intend to install
>>  this as a new /usr/bin/sfilter command, assuming that does not
>>  generate too many objections.  I expect this will work out better
>>  than adding new options to `date' or to `cat'.
>
>First of all, the purpose of my message is to (politely) ask a
>question, not object the proposals so far nor suggest anything --
>so don't be offended.

Heh.  No, I'm not offended by questions!

>The way I understand all these proposals, sfilter will eventually
>be equivalent to sed/awk in terms of features.

No.  My intent is that it will never have regexps, etc.  It will not
allow the user to create arbitrary filters.  It will only support a
certain set of specific and "simple" filtering options.  By simple,
I mean things that it can determine by looking at no more than two
consecutive characters of the file at a time (which is all that 'cat'
currently looks at: "this" character and "the previous" character).
The idea is also to keep the object file very small, ideally very
close to the size of `cat'.

I might bump that up to four consecutive characters, if that was
needed to add some level of unicode awareness in it...

>Now the question: would it be appropriate to extend sed/awk in order
>to implement these cool features?  Or this would break POLA, for
>placing variable timestamps whereas one would expect them to be
>the same for every line, just like the current behavior of sed?

It would make some sense to have these done in `awk', and in fact
everything but the timestamp-related options can already be done in
awk.  But we want FreeBSD to stick with "the one true awk" (that is
it's actual name... :-), so we wouldn't add features there.  Many
people expect `awk' to have the specific features of the original
`awk'.  No more features, no less.  This is important when you write
a script on one computer, and then you want to run the same script
on many other computers without having to worry about what version
of awk is installed.

While I'm sure I could dream up some extension to `sed' to do the
kinds of things I'm thinking of, I personally don't think these
really fit into `sed'.  And even if I did, the same issues would
apply to `sed' as come up for `awk'.  If you go and buy the most
recent, up-to-date book on "Sed & Awk" from O'Reilly, you'll find
that it was last updated in 1997.  And *most* things in those two
commands haven't changed much since the first edition, in 1990.

-- 
Garance Alistair Drosehn     =               drosehn_at_rpi.edu
Senior Systems Programmer               or   gad_at_FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA
Received on Thu Sep 07 2006 - 00:00:41 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:00 UTC