Xref: utzoo comp.unix.wizards:9230 comp.unix.questions:7511 Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: grep replacement Message-ID: <1153@mcgill-vision.UUCP> Date: 10 Jun 88 09:52:46 GMT References: <136@rubmez.UUCP> <449@happym.UUCP> <7944@alice.UUCP> <1037@sun.soe.clarkson.edu> Organization: McGill University, Montreal Lines: 31 In article <1037@sun.soe.clarkson.edu>, nelson@sun.soe.clarkson.edu (Russ Nelson) writes: > In article <23143@bu-cs.BU.EDU> bzs@bu-cs.BU.EDU (Barry Shein) writes: >> From: nelson@sun.soe.clarkson.edu (Russ Nelson) [responding to me] >>> alias with_context tee >/tmp/$$ | $* | context -f/tmp/$$ >> I don't understand, the way to avoid having to tee it into temp >> files is to tee it into temp files? > No. There is no way to avoid teeing it into a temp file. Sure there is. > If you want context then you need to save it. True. But you don't necessarily need to save it in a file. > [the alias above is] the only way to save context in a single-stream > pipe philosophy. Grep can save it in memory. Unless you want so much context that it overflows the available memory, which I find difficult to see happening, this is a perfectly good place to put it. In fact, I wrote a grep variant which starts by snarfing the whole file into (virtual) memory. Makes for extreme speed when it's usable, which is often enough to make it worthwhile (for me, at least). And of course it means that I could get as much context as I cared to. (I've never had it fail because it couldn't get enough memory to hold the whole file.) der Mouse uucp: mouse@mcgill-vision.uucp arpa: mouse@larry.mcrcim.mcgill.edu