Tool -flag considered harmful (was: grep replacement)

Barry Shein bzs at bu-cs.BU.EDU
Wed Jun 15 02:25:57 AEST 1988


The "tool philosphy" is not at question in this grep discussion, the
question is whether grep is the right tool to provide contexts around
pattern matches rather than resorting to some other tool later just
for this special function.

I claim putting it into grep is exactly right, the "tool philosophy"
and parsimony arguments are red herrings, or reductio ad absurdum (why
have grep echo file names when it's easy enough to do in a shell
script? etc etc.)

I've yet to hear an argument here against putting the context function
into grep other than weak bleatings of parsimony.

The argument in favor is obvious, GREP HAS THE $&^%$ CONTEXT IN ITS
LITTLE HANDS, WHY LOOK FOR IT AGAIN? That is, it's just a minor
generalization of what grep does right now, grep prints the context
already, it's simply limited to one text line.

If people think that filename:linenum is so swell why not have grep
*only* produce that under all conditions? Ridiculous, right? The
whole damn argument is ridiculous.

Another anti-filename:linenum argument is what if I want to limit the
output to LESS than a single line, like printing only the exact text
matched? &c.

I may not be exactly right here, I can see complications myself, but I
think someone has to think slightly deeper than "heavens no, not
another flag to grep" as the primary basis for software design, it's
become the Mom and Apple Pie among some circles, excuses anything.  It
provides a convenient bludgeon to use on the novitiate.

(tho I must agree some of these anti-tools arguments are appalling,
the groans of carpetbaggers who would prefer to see their past
failures replicated rather than learn why the system won, like the
arriviste who keep moaning that C isn't more like Fortran or PL/1, I
suspect some of them moaned about the distinct lack of manure in the
streets when autos became popularized.)

	-Barry Shein, Boston University



More information about the Comp.unix.wizards mailing list