help-bash
[Top][All Lists]
Advanced

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

Re: How to pipe just stderr to stdin in a pipeline?


From: Pier Paolo Grassi
Subject: Re: How to pipe just stderr to stdin in a pipeline?
Date: Sun, 10 May 2020 05:30:44 +0200

take also a look at pipexec:

https://github.com/flonatel/pipexec


Il giorno dom 10 mag 2020 alle 05:24 Peng Yu <address@hidden> ha
scritto:

> 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
>
-- 
Pier Paolo Grassi


reply via email to

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