Is it possible to make xargs use only newline as separator? (in bash on Linux and OS X if that matters)
I know -0 can be used, but it's PITA as not every command supports NUL-delimited output.
|
feedback
|
|
Something along the lines of
should work. | |||||
feedback
|
|
GNU xargs (default on Linux, install findutils from MacPorts on OS X to get it) supports -d which lets you specify a custom delimiter for input, so you can do
| |||
feedback
|
|
With Bash, I generally prefer to avoid xargs for anything the least bit tricky, in favour of while-read loops. For your question, I should post a question on SO about the pros & cons of xargs vs. while-read loops... done! | ||||
|
feedback
|
|
Not with the standard version. I have a hacked version that does that - I used it before I knew about ' | |||
|
feedback
|
|
I think you will find that GNU Parallel http://www.gnu.org/software/parallel/ solves both your problems with newline and with running jobs in parallel. Watch the intro video: http://www.youtube.com/watch?v=OpaiGYxkSuQ | |||
|
feedback
|
find -print0 -name \*.foo -maxdepth 1 | xargs -0 -P4is way too much to type compared withls *.foo | xargs -P4. – porneL Mar 31 '10 at 13:21