Recursion with grep?

Francisco Reyes fran at natserv.net
Mon Nov 17 09:39:24 PST 2003


On Thu, 13 Nov 2003, Kirk Strauser wrote:

> Grep works perfectly in that respect, thanks - it's your understanding
> that's a bit askew.  Say you're in a directory with 'file1.c', 'file2.c',
> 'file3.c', etc.  When you type:
>
>     grep -r 'string' *.c
>
> your shell (*not* grep!) is expanding your command line to:


Thanks for shedding some light into this topic.

> Now, grep's man page says this:
>
>        -r, --recursive
>               Read all files under each directory, recursively; this is equiv-
>               alent to the -d recurse option.
>
> > Do we want something like:
> > grep -r <string> *.c
>
> No.  We want to learn the proper usage of our tools.  Take a look at the
> "find | grep" examples elsewhere in the thread.


Although I understand the idea behind keeping tools to specific tasks
sometimes tools do get expanded to take on more work. Not saying my
request is even the best example of something that should be done, but if
you look at the option

-Z, --decompress
 Decompress the input data before searching.  This option is only
 available if compiled with zlib(3) library

We could have said exactly the same you said about my suggestion... don't
add it.. people should learn how to use find, decompres, grep, YET this option WAS implemented.


More information about the freebsd-questions mailing list