Tool -flag considered harmful

Bruce G. Barnett barnett at vdsvax.steinmetz.ge.com
Fri Jun 17 01:30:41 AEST 1988


In article <7986 at alice.UUCP> andrew at alice.UUCP writes:

|-s is potentially faster in that after we get a hit, all we have to do is
|try opening the remaining file arguments (in case we have to return a 2 for
|inaccessible file arguments). in practise, no one bothers to write this
                                  --------
|separate loop and they use the same code as -l.

This seems to be a major loss in efficiency.

While
  grep -s Subject /usr/spool/news/comp/sources/unix/*

might not be painful, something like

  grep -s 'Archive-name: program/part01' /usr/spool/news/comp/sources/unix/*

would be. If indeed -s used the same code as -l, then grep would
still read EVERY LINE OF EVERY FILE - except for the single file that
had the string being searched for.

I really don't see any justification for the waste of CPU cycles.
-- 
	Bruce G. Barnett 	<barnett at ge-crd.ARPA> <barnett at steinmetz.UUCP>
				uunet!steinmetz!barnett



More information about the Comp.unix.questions mailing list