help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] How to merge stdout and stderr yet distinguish what is f


From: Greg Wooledge
Subject: Re: [Help-bash] How to merge stdout and stderr yet distinguish what is from stdout and what is from stderr?
Date: Mon, 5 Feb 2018 08:54:50 -0500
User-agent: NeoMutt/20170113 (1.7.2)

On Sun, Feb 04, 2018 at 03:34:00PM -0600, Peng Yu wrote:
> `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)?

No.

For more details on that "no", see <https://mywiki.wooledge.org/BashFAQ/106>.

But ultimately it's still a "no".


On Sun, Feb 04, 2018 at 06:03:37PM -0600, Peng Yu wrote:
> I tried it multiple times. But the order is not guaranteed to be
> maintained,

Correct!  THAT is the real issue here.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]