Date: Wed, 20 Feb 2002 03:30:21 -0800 From: "Crist J. Clark" <cjc@FreeBSD.ORG> To: rene@xs4all.nl Cc: questions@FreeBSD.ORG Subject: Re: how to search IN a bunch of files? Message-ID: <20020220033021.Z48401@blossom.cjclark.org> In-Reply-To: <20020220121803.E5644@xs4all.nl>; from rene@xs4all.nl on Wed, Feb 20, 2002 at 12:18:04PM %2B0100 References: <20020220121803.E5644@xs4all.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 20, 2002 at 12:18:04PM +0100, rene@xs4all.nl wrote: > Hello. I'd like to be able to search in all files on my freebsd system for a > given regexp. Yes, I want to search the contents of the files specified. > > I can get find(1) to supply me with a list of valid paths, but am unsure > how to grep within all these files. an example would be appreciated. Two basic approches. Run grep(1) on each file once found, $ find /path <your usual set of find parameters> -print -exec grep <regex> {} \; Or run find(1) to get the list of files and grep(1) them all, $ grep <regex> `find /path <your usual set of find parameters>` -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020220033021.Z48401>