logoalt Hacker News

adolphyesterday at 5:53 PM1 replyview on HN

My go-to for fast and easy parallelization is xargs -P.

  find a-bunch-of-files | xargs -P 10 do-something-with-a-file

       -P max-procs
       --max-procs=max-procs
              Run up to max-procs processes at a time; the default is 1.
              If max-procs is 0, xargs will run as many processes as
              possible at a time.

Replies

akdev1lyesterday at 6:33 PM

note that one should use -print0 and -0 for safety

show 1 reply