grep replacement
der Mouse
mouse at mcgill-vision.UUCP
Fri Jun 10 19:52:46 AEST 1988
In article <1037 at sun.soe.clarkson.edu>, nelson at sun.soe.clarkson.edu (Russ Nelson) writes:
> In article <23143 at bu-cs.BU.EDU> bzs at bu-cs.BU.EDU (Barry Shein) writes:
>> From: nelson at 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 at mcgill-vision.uucp
arpa: mouse at larry.mcrcim.mcgill.edu
More information about the Comp.unix.questions
mailing list