grep replacement

Arturo Perez Ext. aperez at cvbnet2.UUCP
Sat May 28 02:53:38 AEST 1988


>From article <662 at fxgrp.UUCP>, by ljz at fxgrp.UUCP (Lloyd Zusman):
> In article <5630 at umn-cs.cs.umn.edu> papowell at attila.UUCP (Patrick Powell) writes:
>   In article <7882 at alice.UUCP> andrew at alice.UUCP writes:
>   >
>   >	Al Aho and I are designing a replacement for grep, egrep and fgrep.
>   >The question is what flags should it support and what kind of patterns
>   >should it handle? ...

Actually, I agree with the guy who posted a request shortly before this
came out.

The most useful feature that is currently lacking is the ability to
do context greps, i.e. greps with a window.  There are two ways this could be
handled.   One is to allow awk-like constructs specifying beginning and 
ending points for a window.  Sort of like, e.g.

	grep -w '/:/,/^$/' file

which would find the lines between each pair of a ':' containing line and
the next following blank line.  The other way would be to have a simple
"number of lines around match" parameter, possibly with collapse of overlapping
windows.  Then you could say

	grep -w 5 foo file

which would print 2 lines above and below the matching line.  Either way
it's done would be nice.  I have made one attempt to implement this
with a script and it wasn't too much fun...

Arturo Perez
ComputerVision, a division of Prime



More information about the Comp.unix.questions mailing list