grep replacement

Russ Nelson nelson at sun.soe.clarkson.edu
Tue Jun 7 01:18:29 AEST 1988


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.  Such is
life with pipes.  If you want context then you need to save it.  My
alias is perfectly consistent with the tool-using philosophy.  Yes,
it's a kludge, but that's the only way to save context in a single-stream
pipe philosophy.  I remember reading a paper in which multiple streams
going hither and yon were proposed, but the syntax was gothic at best.
I like being able to say this:

bsd:	sort | with_context grep rfoo | more
sysv:	sort | with_context grep foo | more
	Because sysv doesn't have the r* utilities, of course :-)
-- 
signed char *reply-to-russ(int network) {	/* Why can't BITNET go	*/
if(network == BITNET) return "NELSON at CLUTX";	/* domainish?		*/
else return "nelson at clutx.clarkson.edu"; }



More information about the Comp.unix.questions mailing list