I'm scraping data from the web, and I have several processes of my scraper running in parallel.
I want the output of each of these processes to end up in the same file. As long as lines of text remain intact and don't get mixed up with each other, the order of the lines does not matter. In UNIX, can I just pipe the output of each process to the same file using the >> operator?
Briefly, no.
>>
doesn't respect multiple processes.No. It is not guaranteed that lines will remain intact. They can become intermingled.
From searching based on liori's answer I found this:
So lines longer than {PIPE_BUF} bytes are not guaranteed to remain intact.
As mentioned above it's quite a hack, but works pretty well =)
same thing with '>>' :
and with exec on the last one you save one process: