I'm trying to process input in different ways in parallel, writing out the resulting lines as they come in. My current approach is this:
# process_parallel.sh
read input
parallel --colsep ' ' --linebuffer 'echo $input | {}' \
::: 'python process1.py' ./process2.sh ./process3
The context boils down to something like this:
(sleep 1; echo "short input arriving late") | ./process_parallel.sh | ./collate_results.sh
The above works but has one important drawback: The processes are not started until the input has been read. I want to start them immediately since that may take a while, then have parallel pipe its full stdin to each of them.
How do I achieve that?