home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] is "xargs" really still useful just for limiting command line size?

  • Subject: Re: [OCLUG-Tech] is "xargs" really still useful just for limiting command line size?
  • From: Shawn H Corey <shawnhcorey [ at ] gmail [ dot ] com>
  • Date: Fri, 16 Mar 2018 10:26:36 -0400
On Fri, 16 Mar 2018 09:59:53 -0400
"Michael P. Soulier" <msoulier [ at ] digitaltorque [ dot ] ca> wrote:

> On 16/03/18 Robert P. J. Day said:
> 
> >   course i taught recently had a section on "xargs", emphasizing its
> > value(?) in being able to run a command in bite-size pieces but,
> > these days, is that really that much of an issue?
> 
> My main use for it.
> 
> git ls-files | xargs grep 'function_name'
> _______________________________________________
> Linux mailing list
> Linux [ at ] lists [ dot ] oclug [ dot ] on [ dot ] ca
> http://oclug.on.ca/mailman/listinfo/linux


git ls-files -z | xargs -0 grep 'function_name'

The -z separates the names with a ASCII NUL and the -0 (minus zero)
allows xarg to read them correctly. This is useful if the files have
spaces in their names.


-- 
Don't stop where the ink does.

	Shawn H Corey