Piping error messages with grep

前端 未结 2 1372
独厮守ぢ
独厮守ぢ 2021-01-21 15:14

I have a script that fails because some files are missing.

Running the script and piping it to grep

$ ./adder | grep Error

produces th

2条回答
  •  既然无缘
    2021-01-21 15:48

    Like piokuc's suggests, combine stderr with stdout. However, I think you are looking a better invocation of grep:

    ./adder 2>&1 | grep "^Error" | grep -oP '[^ ]*\.root'
    

提交回复
热议问题