So I have a while loop:
cat live_hosts | while read host; do \
sortstuff.sh -a "$host" > sortedstuff-"$host"; done
But this can take a long time. How would I use GNU Parallel for this while loop?
filesgnu-parallelshell-script
So I have a while loop:
cat live_hosts | while read host; do \
sortstuff.sh -a "$host" > sortedstuff-"$host"; done
But this can take a long time. How would I use GNU Parallel for this while loop?
Best Answer
You don't use a while loop.
Note that this won't work if you have paths in your
live_hosts
(e.g./some/dir/file
) as it would expand tosortstuff.sh -a /some/dir/file > sortedstuff-/some/dir/file
(resulting inno such file or directory
); for those cases use{//}
and{/}
(seegnu-parallel
manual for details):