Redirect python script output to grep

c++, cocos2d-x, grep, python, shell

Solution

You need to redirect `stderr` to `stdout`. Only then will grep filter out all lines not containing "error"

python ./build_native.py 2>&1 | grep "error" 

Problem

There is a python script that builds cocos2dx-project. When it runs it prints out all the warning and error messages. But I want to get only those lines that contain "error". Therefore, I do the following: ``` python ./build_native.py | grep "error" ``` But it still prints everything, not only "error" lines. EDIT: In case you need the content of the script file, you can see it here.

Original source