[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] [RFC] add support for input/output count of lines
From: |
Stepan Kasal |
Subject: |
Re: [PATCH] [RFC] add support for input/output count of lines |
Date: |
Fri, 1 Oct 2004 13:21:34 +0200 |
User-agent: |
Mutt/1.4.1i |
Hello,
On Fri, Oct 01, 2004 at 11:54:46AM +0200, Roberto Nibali wrote:
> Also I don't really see where the GNU grep authors draw the line between
> 'grep requirement' and 'grep feature' when I look at its man page [...]
I admit that the line is not clear.
The line was crossed with the --recursive option, which later naturally
brought --include and --exclude.
Some people really wanted short alias, like `rgrep', while other still
use find and xargs...
> >gawk '/foobar/{print; n++} END{print n"/"NR > "/dev/stderr"}'
>
> Yes, we'll try to do that and see if it works with our command chain and
> the speical requirement of multiple pattern (mixed AND/OR/NEGATE) matching.
If you want to use multiple patterns, then you definitely need
a programming language, like awk.
That /foobar/ can be replaced by any expression. See ``info gawk''.
> >[that's only my opinion, I'm not a grep developper, I also tend
> >to think that the "-r", "--include"... options would have best
> >be suited in a tree walker command as it has nothing to do with
> >grep's first purpose]
That's reasonable argument. Fortunately, I don't heve to decide whether
it outweights the pros of -r, as -r is already in. :-)
> array of options one could specify for desired output, like it is done with
> the 'ps -o ...' or top commands.
Well, grep -Z gives you an unambiguous output which can be easily parsed.
Then you can reformat the output.
Stepan Kasal