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

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

 



On Sat, 2008-11-01 at 13:53 +0530, Vimal wrote:
> You could use find and it's exec option. Or, you could also use find and xargs.
> 
> $ find . -type f -iname '*.h' -exec grep -H 'test' {} \;
> or
> $ find . -type f -iname '*.h' | xargs grep -H 'test'

xargs is going to be the more efficient option

> `xargs program-with-options' does something like this:
> 
> for each line in stdin:
>   invoke program-with-options $line

Actually, it's more like

while stdin not empty:
  args_list = []
  while arg_list < maximum length:
     push a line from stdin into arg_list
  invoke program with arg_list



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[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