[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Search in files with particular extension
From: |
Eli Zaretskii |
Subject: |
Re: Search in files with particular extension |
Date: |
Thu, 11 Jan 2007 22:52:11 +0200 |
> Date: Thu, 11 Jan 2007 09:00:08 -0700
> From: address@hidden (Bob Proulx)
> Cc: address@hidden
>
> > 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"
It also has an extra bonus of not requiring find and xargs.