new grep

XMRP50000[jcm]-a.v.reed avr at mtgzz.att.com
Wed Jun 22 04:29:38 AEST 1988


In article <16237 at brl-adm.ARPA>, williams at 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 <rbj at icst-cmr.arpa>
< 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)



More information about the Comp.unix.wizards mailing list