find -print0 (was Re: svn commit: trunk/busybox )
Paul Fox
pgf at brightstareng.com
Fri May 12 14:58:36 UTC 2006
> >
> oh, forgive me for not understanding what xargs does. so basically
> it's a replacement for backticks without the limit on command line
> length? if so, i suppose a version with newline separators can still
> be done in shell script..
i'm sure it could.
but don't underestimate the power of xargs. i'm always surprised
at how many people don't know and use it.
say you have a list of files in a window somewhere, and would
like to edit them. just sweep them with your mouse, type "xargs vi",
paste the list, and there you go.
i often use it multiple times on a commandline. say you want to
fix all misspellings of "Copyright" in your source tree:
find . -name '*.[ch]' | xargs egrep -li copywrite | xargs vi
you could do any of the above examples using backticks, but you'd
have to think and type in some sort of reverse order. using
xargs, you build the pipeline naturally -- first tune the find
expressions, then tune the egrep, then add the -l and the "| xargs vi")
maybe it's like the difference between postfix and infix notation
for using a calculator... some people vastly prefer one to the
other.
anyway, back to the subject line: i just committed -print0 support
for find. so that line can remain in the makefile. :-)
paul
=---------------------
paul fox, pgf at brightstareng.com
More information about the busybox
mailing list