Ralph Shumaker wrote:
> Todd Walton wrote:
> 
> >
> >      -C NUM, --context=NUM
> >             Print NUM lines of output context.  Places a line
> >containing --  between contiguous
> >             groups  of matches.
> 
> That's cool, but in a four stage pipe it would be necessary to include 
> that switch four times.  Still, it's something to consider.  Thanks.

alias cgrep='grep --context=4'
cgrep aba /tmp/file | cgrep bcb | cgrep cdc | cgrep ded

Modify the cgrep alias to suit whatever other flags you need, such as -i

If you are using sh or bash:

o="--context=4 -i"
grep $o aba /tmp/file | grep $o bcb | grep $0 cdc | grep $o ded

for zsh:
o=(--context=4 -i)
grep $o aba /tmp/file | grep $o bcb | grep $0 cdc | grep $o ded

-john


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to