Thursday, February 5, 2015

Gnu Parallel

I had never heard of this til now, but it looks like it can make some tasks in Bash much simpler/faster.

From: https://en.wikipedia.org/wiki/GNU_parallel

The idea is to convert code such as:

for x in `cat list` ; do
do_something "$x"
done | process_output


Into


cat list | parallel do_something | process_output


Another simple example someone posted on the Arch Wiki (s/printf/echo/):


printf "world\nasynchronous processing" | parallel "echo hello, {}"

hello, world
hello, asynchronous processing

No comments:

Post a Comment