How can I pipe stderr, and not stdout?

后端 未结 11 1170
-上瘾入骨i
-上瘾入骨i 2020-11-22 03:28

I have a program that writes information to stdout and stderr, and I need to process the stderr with grep, leaving

11条回答
  •  北海茫月
    2020-11-22 03:56

    If you are using Bash, then use:

    command >/dev/null |& grep "something"
    

    http://www.gnu.org/software/bash/manual/bashref.html#Pipelines

提交回复
热议问题