Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site utah-gr.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!utah-cs!utah-gr!thomas From: thomas@utah-gr.UUCP (Spencer W. Thomas) Newsgroups: net.unix Subject: Re: fgrep (isn't) Message-ID: <1532@utah-gr.UUCP> Date: Tue, 30-Jul-85 22:04:05 EDT Article-I.D.: utah-gr.1532 Posted: Tue Jul 30 22:04:05 1985 Date-Received: Thu, 1-Aug-85 08:54:50 EDT References: <495@unisoft.UUCP> <5785@utzoo.UUCP> <507@unisoft.UUCP> Reply-To: thomas@utah-gr.UUCP (Spencer W. Thomas) Organization: Univ of Utah CS Dept Lines: 36 Not to continue flogging a dead horse, but I think (mixing my metaphors), I may be able to shed a little more light here. (Then again, maybe not.) In article <507@unisoft.UUCP> fnf@unisoft.UUCP (Fred Fish) writes: >From the system V User's Manual grep(1): >... > "Egrep patterns are full regular *expressions*..." You didn't quote the relevant part about egrep (unless this has been deleted from the SYS V manual). The '...' expands to "it uses a fast deterministic algorithm..." When read carefully, this indicates that egrep has the potential of being faster. The problem with egrep is "that [it] sometimes needs exponential space." Timings of '*grep foo *' on a large directory yield the information egrep 5.8u 1.6s 0:17 41% 19+40k 217+13io 2pf+0w grep 7.0u 1.7s 0:34 25% 7+15k 225+22io 1pf+0w fgrep 10.0u 1.8s 0:47 24% 7+15k 211+7io 3pf+0w showing `clearly' the superiority of egrep in this case. I think that in Fred's example, the setup time for egrep may have overwhelmed the search time (that's the only theory I can think of, anyway), so that perhaps grep is better for single file searches, but it has been our experience that egrep is better when searching over a large number of files. (To forstall the obvious followups:) It seems clear, from previous postings, that 'bm' or 'bgrep' are better for the simple case of searching for strings. -- =Spencer ({ihnp4,decvax}!utah-cs!thomas, thomas@utah-cs.ARPA) "You don't get to choose how you're going to die. Or when. You can only decide how you're going to live." Joan Baez