Re: Recursion with grep?
From: Kirk Strauser (kirk_at_strauser.com)
Date: 11/14/03
- Previous message: Ernesto Antonio Lira Castro: "RV: FW: Script configure failed unexpectedly"
- In reply to: Francisco J Reyes: "Re: Recursion with grep?"
- Next in thread: Francisco Reyes: "Re: Recursion with grep?"
- Reply: Francisco Reyes: "Re: Recursion with grep?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: freebsd-questions@freebsd.org Date: Thu, 13 Nov 2003 23:46:19 -0600
At 2003-11-14T03:42:18Z, Francisco J Reyes <fran@natserv.net> writes:
> I think I am going to research what would it take for someone to fix grep
> and pay them.
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:
grep -r 'string' file1.c file2.c file3.c
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.
None of the arguments you specified at the command line are directories -
they're all files. What would you say is the proper behavior for recursing
into a file?
grep did exactly what you asked it to; your request was not what you thought
it was, but grep had no way of knowing.
> How do think we would want grep to work?
>
> 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.
-- Kirk Strauser "94 outdated ports on the box, 94 outdated ports. Portupgrade one, an hour 'til done, 82 outdated ports on the box."
- application/pgp-signature attachment: stored
- Previous message: Ernesto Antonio Lira Castro: "RV: FW: Script configure failed unexpectedly"
- In reply to: Francisco J Reyes: "Re: Recursion with grep?"
- Next in thread: Francisco Reyes: "Re: Recursion with grep?"
- Reply: Francisco Reyes: "Re: Recursion with grep?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|