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

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



> 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
>

Ah, thanks for clearing few things! :-) Is this why xargs is more efficient?

This thing pointed out the difference:
$ ls | xargs echo
vs.
$ ls | perl -lane 'print $F[0]'

:-)

For others who might be reading this, find also has a similar option.
From it's manpage:

    -exec utility [argument ...] {} +
       Same as -exec, except that ``{}'' is replaced with as many pathnames as
       possible for each invocation of utility. This behaviour is similar to
       that of xargs(1).

-- 
Vimal

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