[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Search in files with particular extension
From: |
Bob Proulx |
Subject: |
Re: Search in files with particular extension |
Date: |
Thu, 11 Jan 2007 14:53:16 -0700 |
User-agent: |
Mutt/1.5.9i |
Eli Zaretskii wrote:
> > Bob Proulx wrote:
> > > How do i restrict the search with files of particular extension
> > > using "grep" command.
> >
> > Use the find command. Example to only grep through html file.
> >
> > find . -name '*.hmtl' -print0 | xargs -r0 grep PATTERN
>
> This is no longer needed, with reasonably current GNU Grep. The
> following is much faster and easier to type:
>
> grep -R PATTERN . --include="*.html"
Using find has the advantage that it works with all of the utilities
uniformly and one does not need to learn the particular details that
apply only to grep.
> It also has an extra bonus of not requiring find and xargs.
A system that has grep but not find is not a usable system, IMNHO. :-)
Bob