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 .
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"
如果您只想传递错误,则可能需要尝试以下方法:
python ./build_native.py 2>&1 >/dev/null | grep "error"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.