So in Linux, I want to run a script 4 times, then do stuff to the output.
I can do:
script 1 > output1.txt script 2 > output2.txt script 3 > output3.txt script 4 > output4.txt cat output1.txt output2.txt output3.txt output4.txt > output5.txt sort output5.txt | uniq -u
But I'd like the first four to run in parallel (faster). If I put them in the background, then it'll jump to the fifth line, which will not be successful until the first four finish.
EDIT: Thanks for responses. I tried a few of these, but I'm not sure if they will work, because I need (a) 4 different scripts to run in parallel, not the same one four times, and (b) the outputs of each script need to be saved to a .txt file (this is very important). I've updated the above to reflect this.
People in my office love using xargs, so that would be my preference (though I'm open to anything).