Timeline for Creating a single output stream out of three other streams produced in parallel
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 30, 2012 at 10:21 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 | added 73 characters in body |
| Oct 30, 2012 at 10:18 | comment | added | Stéphane Chazelas | @RichardHansen. That's true, but I'm not sure it's worth complicating the answer to cover for this pathological case. Note that the behaviour for text utilities like grep for such input is unspecified (by POSIX). For instance, GNU grep adds back the missing LF character which may not be what you want (though in this case, it's likely to be what the OP would want). While we're at it, we may also want to cover other kinds of non-text output like overlong lines or lines which contain NUL characters... | |
| Oct 30, 2012 at 4:03 | comment | added | Richard Hansen | Great answer. You may want to do IFS= read -r l || [ -n "${l}" ] in case the last line of output is not terminated with a newline. | |
| Oct 26, 2012 at 6:38 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 | added 422 characters in body |
| Oct 26, 2012 at 6:13 | comment | added | Stéphane Chazelas | OK @Cerales, see my updated answer | |
| Oct 26, 2012 at 6:13 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 | added 543 characters in body |
| Oct 25, 2012 at 22:16 | comment | added | Cera | No, I still get mangled output. Lines get mixed together and interleaved. | |
| Oct 25, 2012 at 19:31 | comment | added | derobert | Indeed, I tested, you are correct. | |
| Oct 25, 2012 at 17:51 | comment | added | Stéphane Chazelas | No unless some of the programs close their stdout before exiting, because the pipe and sort -n will remain until all programs that have an fd open on it have exited. | |
| Oct 25, 2012 at 17:44 | comment | added | derobert | You need a wait in there, I think. | |
| Oct 25, 2012 at 12:31 | history | answered | Stéphane Chazelas | CC BY-SA 3.0 |