[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to pipe just stderr to stdin in a pipeline?
From: |
Peng Yu |
Subject: |
Re: How to pipe just stderr to stdin in a pipeline? |
Date: |
Sat, 9 May 2020 22:24:29 -0500 |
Thanks. The original stdout must be redirected back to stdout (see
"2>&1"). I have to use something like this to do it. This looks quite
cumbersome.
$ { { echo error 1>&2; echo out; } 3>&1 1>&2 2>&3 | awk -e '{ print
"awk:", $0 }'; } 2>&1 | awk -e '{ print "awk2: " $0 }'
awk2: out
awk2: awk: error
Is it better to add an operator similar to | and |& so that only
stderr is piped to stdin of the next command in the pipeline?
On Sat, May 9, 2020 at 10:11 PM Pier Paolo Grassi
<address@hidden> wrote:
>
> I would use:
>
> {cmd1 3>&2 2>&1 1>&3 } | cmd2
>
> Il giorno dom 10 mag 2020 alle ore 05:04 Peng Yu <address@hidden> ha scritto:
>>
>> | pipes stdout to stdin in a pipeline
>> |& pipes both stdout and stderr to stdin in a pipeline
>>
>> What is the best way to just pipe stderr (but not stdout) to stdin in
>> a pipeline? Thanks.
>>
>> --
>> Regards,
>> Peng
>>
--
Regards,
Peng
- How to pipe just stderr to stdin in a pipeline?, Peng Yu, 2020/05/09
- Re: How to pipe just stderr to stdin in a pipeline?, Pier Paolo Grassi, 2020/05/10
- Re: How to pipe just stderr to stdin in a pipeline?,
Peng Yu <=
- Re: How to pipe just stderr to stdin in a pipeline?, Pier Paolo Grassi, 2020/05/10
- Re: How to pipe just stderr to stdin in a pipeline?, Peng Yu, 2020/05/10
- Re: How to pipe just stderr to stdin in a pipeline?, Pierre Gaston, 2020/05/10
- Re: How to pipe just stderr to stdin in a pipeline?, Peng Yu, 2020/05/10
- Re: How to pipe just stderr to stdin in a pipeline?, Andreas Kusalananda Kähäri, 2020/05/10
- Re: How to pipe just stderr to stdin in a pipeline?, Peng Yu, 2020/05/10
- Re: How to pipe just stderr to stdin in a pipeline?, Eli Schwartz, 2020/05/10
- Re: How to pipe just stderr to stdin in a pipeline?, Greg Wooledge, 2020/05/11
- Re: How to pipe just stderr to stdin in a pipeline?, Peng Yu, 2020/05/11
- Re: How to pipe just stderr to stdin in a pipeline?, Koichi Murase, 2020/05/11