Better HN
topnewbestaskshowjobs
Log inSign up

tange

6 karma · joined Jul 9, 2010 (16y ago) · 5 submissions

Submissions

comment 15y ago · link · parent

You can emulate it with sem:

    find . -exec sem --id my_find -j3 sleep 4\; echo {} \;
See more about sem: http://www.gnu.org/software/parallel/sem.html

comment 16y ago · link · parent

Please read http://www.gnu.org/software/parallel/man.html#differences_be... before selecting dxargs.

comment 16y ago · link · parent

Your use of xargs can lead to nasty surprises because of the separator problem http://en.wikipedia.org/wiki/Xargs#The_separator_problem

GNU Parallel http://www.gnu.org/software/parallel/ does not have that problem.

Watch the intro video for GNU Parallel: http://www.youtube.com/watch?v=OpaiGYxkSuQ

comment 16y ago · link · parent

Like this (if you have GNU Parallel http://www.gnu.org/software/parallel/ installed) to run on multiple computers:

find images | parallel -j+0 –trc {.}.out -S server1,server2,: “do_stuff {} > {.}.out”

Watch the intro video for GNU Parallel: http://www.youtube.com/watch?v=OpaiGYxkSuQ

comment 16y ago · link · parent

xargs cannot replace {} with a lot of arguments, so if mv did not have --target-directory, then xargs would have to do:

   find ... | xargs -0 -i {} mv {} ~/Pictures
which would run one mv per file.

GNU Parallel http://www.gnu.org/software/parallel/ allows for replacing {} with multiple arguments. So this would do the right thing:

   find ... | parallel -X -0 mv {} ~/Pictures
GNU Parallel is useful for many other applications. Watch the intro video to learn more: http://www.youtube.com/watch?v=OpaiGYxkSuQ