1

Is it possible to use gnu-parallel to run multiple commands which all read from stdin?

For example:

echo 'hello world' | parallel --keep-order --tagstring 'Part {=$_=uc($_)=}:' --pipe "cat" ::: {a,b}

I would like to see:

Part A: hello world
Part B: hello world

as output. However, I only see:

Part A: hello world

I've also tried:

echo 'hello world' | parallel --keep-order --tagstring 'Part {=$_=uc($_)=}:' --pipe --fifo 'cat < {}' ::: {a,b}

but the output is also wrong

What am I missing?

1 Answer 1

1

Looks like gnu parallel actually comes with a --tee option (lol).

Pipe all data to all jobs.

The solution is fairly simple:

echo 'hello world' | parallel --keep-order --tagstring 'Part {=$_=uc($_)=}:' --pipe --tee "cat" ::: {a,b}

Output:

Part A: hello world
Part B: hello world

As expected

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .