function process_file {
file=$1
do_something_with $file
}
export -f process_file
find PATH -type f | xargs --max-args=1 --max-procs=NUM -I{} bash -c process_file \{\}
or a shorter version
find PATH -type f | xargs -n1 -PNUM -I{} bash -c process_file \{\}
Where NUM is the number of parallel jobs and PATH where to start looking for the files.
source
No hay comentarios:
Publicar un comentario