Average Rating: 4.3/5.0Number of Ratings: 171Number of Reviews: 1
My Review of GNU findutils
|You have not rated or reviewed this project.Click below to rate/review.||My Rating:|
'find' is a great tool, really powerful and useful.
'xargs', however, looks like a promising tool but I rarely use it because it is cumbersome to use. Basically, since the default behavior reads items separated by whitespace, 'xargs' is very difficult to use with filenames that might contain spaces. I know there must be some set of parameters to fix this, but then its use becomes less straightforward. Even the manpage recognizes this: "Because Unix filenames can contain blanks and newlines, this default behaviour is often problematic"
For this reason, I've never used xargs in years.
If I need to run something for multiple files, I do this (in bash):
for a in * ; do something "$a" ; done
Which is easier to read and to write (although slightly verbose).
Another option is this:
some | commands | here | while read a ; do something "$a" ; done
Finally, I can also just use the -exec parameter from 'find'.