Peng Yu
2018-02-04 21:34:00 UTC
Hi,
`cmd 2>&1` can be used to merge stdout stderr into one stream. But the
content from stdout and stderr are not distinguishable anymore.
Is there a way to not only merge stdout and stderr but also prepend
each line from stdout with a prefix and prepend each line from stderr
with a different prefix (e.g., 'o' and 'e' respectively) so that they
are distinguishable (we assume that there will be no merged lines
coming from both stdout and stderr)?
Maybe this can be done through an external program, but I am not sure
how to implement, especially, if I want the order of the lines
combined from both streams unchanged whether there are prefixes or
not.
Does anybody know a solution to this problem? Thanks.
`cmd 2>&1` can be used to merge stdout stderr into one stream. But the
content from stdout and stderr are not distinguishable anymore.
Is there a way to not only merge stdout and stderr but also prepend
each line from stdout with a prefix and prepend each line from stderr
with a different prefix (e.g., 'o' and 'e' respectively) so that they
are distinguishable (we assume that there will be no merged lines
coming from both stdout and stderr)?
Maybe this can be done through an external program, but I am not sure
how to implement, especially, if I want the order of the lines
combined from both streams unchanged whether there are prefixes or
not.
Does anybody know a solution to this problem? Thanks.
--
Regards,
Peng
Regards,
Peng