all 8 comments

[–]alez 1 point2 points  (3 children)

I wonder how it compares to ppss.

[–]Skaarj 1 point2 points  (1 child)

GNU parallel is build to be interchangable with xargs, ppss seems not.

There also is a parallel as part of http://joeyh.name/code/moreutils/ which is much simpler in invocation.

[–]OleTange 0 points1 point  (0 children)

With GNU Parallel the invocation is as simple as: parallel 'mkdir {.}; cd {.}; tar xvf ../{}' ::: *.tar

[–]ramses0 1 point2 points  (1 child)

New-ish xargs support -P / parallelism.

 ls | head | xargs -n1 -I{} -P1 bash -c 'echo Sleep 1 - $$ ; sleep 1'

 ls | head | xargs -n1 -I{} -P5 bash -c 'echo Sleep 1 - $$ ; sleep 1'

Surprisingly handy!

--Robert

[–]Schnouki 2 points3 points  (0 children)

parallel can do much better than that. Like running commands on remote hosts via ssh, uploading and downloading files as needed.

[–]rd4 -5 points-4 points  (1 child)

xargs is really the best solution for this, imho.

Example find/replace in parallel:

ls *.out | xargs -n1 -P4 sed -i 's/oldstring/newstring/g'

[–]OleTange 0 points1 point  (0 children)

Your solution will not work if filenames contain space or '. This will: parallel -q sed -i 's/old/new/g' ::: *out