Timeline for Combine the output of two commands in bash
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 14, 2024 at 6:20 | comment | added | G-Man Says 'Reinstate Monica' | Hello? Writing output from two successive commands to the same file (without using >>) causes the second to overwrite the output from the first — except in this case, where the first command is in the background (i.e., the processes are asynchronous), there will be a race as both processes overwrite each other. | |
| Nov 15, 2017 at 7:39 | comment | added | Ole Tange | On top of that your disk may run full if the amount of data is big. | |
| Nov 15, 2017 at 7:38 | comment | added | Ole Tange | Be warned: This doesn't preserve whole lines! You'll get unreliable outputs as lines get split up part way and mixed up among each other. You can try this with command1 = yes {1..20} command2 = yes {1..20} and pipe the combined output through | grep -v '^1 2 3' which ideally won't print anything if lines aren't broken. (H/t to @antak). | |
| Nov 22, 2016 at 17:58 | comment | added | Abdennour TOUMI | @chovy: could u write your issue as question here ... it is useful | |
| Nov 16, 2016 at 20:25 | comment | added | chovy | can specify 2 different log files and do tail -f *.log although I've never seen this as a problem with 2 different processes writing to the same log file. | |
| Nov 16, 2016 at 15:06 | comment | added | Djizeus | Note: this may cause I/O errors if the two processes try to write to the file "at the same time". | |
| Feb 18, 2013 at 19:29 | vote | accept | chovy | ||
| Feb 15, 2013 at 21:59 | history | answered | chovy | CC BY-SA 3.0 |