[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re: searching inside files with find, cat and grep as a oneliner ...



On Sat, Sep 18, 2010 at 12:01:17PM +0100, Clive Standbridge wrote:
> > Search all files under the home directory (recursively) with an
> > extension of .txt
> > for the keyword "xorg":
> > 
> > grep -r xorg ~/*.txt
> 
> That looks like a misunderstanding. That command actually causes grep
> to search
> (a) files matching *.txt in the home directory.
> (b) files of ANY name, contained in subdirectories named *.txt in the
> home directory.
> 
> To search all files under the home directory (recursively) with an
> extension of .txt, you will need to use find .. | xargs or find
> .. -exec ... {} + as discussed previously,

I guess you're looking for:
grep -r --include='*.txt' xorg ~

-- 
1KB		// Microsoft corollary to Hanlon's razor:
		//	Never attribute to stupidity what can be
		//	adequately explained by malice.

Attachment: signature.asc
Description: Digital signature


Reply to: