Re: how to ask grep to search specific file recurisively?

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

 



On Sat, 1 Nov 2008 13:51:37 +0530 "Manish Katiyar" <mkatiyar@xxxxxxxxx>
wrote:
> This is really not a kernel question......but anyway the following
> command should be good enough for you.
> 
> find . -name '*.h' -exec grep test {} /dev/null \;

This is lot faster because it doesn't need to start a grep process for
every .h file find finds:

find . -name '*.h' -print0 | xargs -0 grep test /dev/null

The -print0 is to be able to process files with spaces or other funny
characters in them. Usually not useful in the kernel, but for generic
use it is.


Erik

-- 
Erik Mouw -- mouw@xxxxxxxxxxxx
GPG key fingerprint: D6AC 7F15 A26E C5C4 62E0  4A58 FCF9 551C 9B48 B68D

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux