From owner-freebsd-questions@FreeBSD.ORG Thu Nov 13 21:46:36 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C649316A4CE for ; Thu, 13 Nov 2003 21:46:36 -0800 (PST) Received: from kanga.honeypot.net (kanga.honeypot.net [208.162.254.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1C27343F93 for ; Thu, 13 Nov 2003 21:46:35 -0800 (PST) (envelope-from kirk@strauser.com) Received: from pooh.strauser.com (pooh.honeypot.net [10.0.5.128]) by kanga.honeypot.net (8.12.10/8.12.10) with ESMTP id hAE5kWEX090837 for ; Thu, 13 Nov 2003 23:46:33 -0600 (CST) (envelope-from kirk@strauser.com) To: freebsd-questions@freebsd.org References: <20031113183118.T3617@d66-183-123-52.bchsia.telus.net> <20031113223951.X85161@zoraida.natserv.net> From: Kirk Strauser Date: Thu, 13 Nov 2003 23:46:19 -0600 In-Reply-To: <20031113223951.X85161@zoraida.natserv.net> (Francisco J. Reyes's message of "Thu, 13 Nov 2003 22:42:18 -0500 (EST)") Message-ID: <87ptfv33kk.fsf@strauser.com> Lines: 43 X-Mailer: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Subject: Re: Recursion with grep? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Nov 2003 05:46:36 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable At 2003-11-14T03:42:18Z, Francisco J Reyes 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 equ= iv- 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 *.c No. We want to learn the proper usage of our tools. Take a look at the "find | grep" examples elsewhere in the thread. =2D-=20 Kirk Strauser "94 outdated ports on the box, 94 outdated ports. Portupgrade one, an hour 'til done, 82 outdated ports on the box." --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQA/tGw45sRg+Y0CpvERAhOdAJ9rMJ13enk1QFf3WkQs0xC3ogJQqgCeJ5tY CJDpu8Lk6BeQAVkWl9PbqTM= =oYDd -----END PGP SIGNATURE----- --=-=-=--