我想在 cppcheck 的输出上使用 awk - 但似乎 cppcheck 在这一行的末尾没有输出到 awk 将打印到屏幕上。有没有办法让 cppcheck 的输出只进入到 awk 的管道中,以便我可以过滤它?
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