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: "Robert P. J. Day" <rpjday [ at ] crashcourse [ dot ] ca>
  • Date: Fri, 16 Mar 2018 10:45:34 -0400 (EDT)
On Fri, 16 Mar 2018, Shawn H Corey wrote:

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

  again, as i mentioned, i do understand the value of xargs because of
the plethora of useful "tricks" like the above, but those features
aside, the basic question is still, does xargs still have value
*solely* for its ability to run commands in bite-size pieces?

rday