grep replacement

Root Boy Jim rbj at icst-cmr.arpa
Wed Jun 1 02:57:26 AEST 1988


   From: Bill Wyatt <wyatt at cfa.harvard.edu>

   > There have been times when I wanted a grep that would print out the
   > first occurrence and then stop.

   grep '(your_pattern_here)' | head -1

Well, that *prints* what I want to see, but takes longer than I want to
wait. I want it to quit looking in the file. Besides, there is no way
you can do `grep -1 pattern *.[ch]' as trivially.

   Bill    UUCP:  {husc6,ihnp4,cmcl2,mit-eddie}!harvard!cfa!wyatt
   Wyatt   ARPA:  wyatt at cfa.harvard.edu
	    (or)  wyatt%cfa at harvard.harvard.edu
	 BITNET:  wyatt at cfa2
	   SPAN:  cfairt::wyatt 

	(Root Boy) Jim Cottrell	<rbj at icst-cmr.arpa>
	National Bureau of Standards
	Flamer's Hotline: (301) 975-5688
	The opinions expressed are solely my own
	and do not reflect NBS policy or agreement
	My name is in /usr/dict/words. Is yours?



More information about the Comp.unix.wizards mailing list