2015-01-24 4 views
1

awk를 cppcheck의 출력에 사용하고 싶습니다. 그러나 cppcheck가이 라이너의 끝에 awk에 출력하지 않는 것처럼 보입니다. cppcheck의 출력을 awk에 파이프로 보내서 필터 할 수있는 방법이 있습니까?cppcheck가 파이프와 잘 작동하도록하기

git status -s | awk '(($1 ~ /M/) || ($1 ~ /A/)) { print $2 }' | xargs cppcheck -j 2 --enable=warning,performance | awk '/error/ { print $1 }' 

그리고 여기 내 출력

[silly.cpp:9]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'char *'. 
[silly.cpp:7]: (error) Buffer is accessed out of bounds: buf 

답변

2

아마 대신 표준 출력의 stderr로하고 출력하기 것입니다. 시도 :

cppcheck ... 2>&1 | awk ... 
관련 문제