Path: utzoo!utgpu!water!watmath!clyde!att!mtunx!whuts!homxb!mtuxo!mtgzz!avr
From: avr@mtgzz.att.com (XMRP50000[jcm]-a.v.reed)
Newsgroups: comp.unix.wizards
Subject: Re: new grep
Summary: Please make the flags orthogonal and consistent
Message-ID: <4219@mtgzz.att.com>
Date: 21 Jun 88 18:29:38 GMT
References: <16237@brl-adm.ARPA>
Organization: AT&T, Middletown NJ
Lines: 34

In article <16237@brl-adm.ARPA>, williams@nrl-css.arpa writes:
< 	        Al Aho and I are designing a replacement for grep, egrep
< 		and fgrep.  The question is what flags should it support and
< 		what kind of patterns ...
< 	 
< 	I have always thought it would be nice to print only the first match.
< 	        (Root Boy) Jim Cottrell 
< I'll second this.  There have been many times when I simply wanted to
< detect the presence of a pattern in a file, then stop searching.  Combining
< this with the -n option can also be useful.

This would be a good time to make the flags orthogonal and
consistent. Ideally, all standard output should be requested in
the same way, by specifying the corresponding flag. The default
should be something like the -s option today; the way to specify
one's own favorite options would be by defining an alias, e.g.

                mygrep="grep -i -l -n -m"

The options I'd like to see are:

	-l	List paths (names) of files with matches
	-n	Number: list numbers of lines that match
	-b	Block: list block number for each match
	-m	Matching lines: list matching lines
	-c	Display a count of maching lines in each file
	-o	One: Don't search beyond one match per file

plus the -v, -i, -e, and -f options as they are now. Ideally,
there should be a new name; if the new tool is called with one of
the names that exist today, then the behavior of the old tool of
that name ought to be emulated exactly.

				Adam Reed (mtgzz!avr)