Skip to content

Instantly share code, notes, and snippets.

@zbyhoo
Created April 27, 2011 12:09
Show Gist options
  • Save zbyhoo/944141 to your computer and use it in GitHub Desktop.
Save zbyhoo/944141 to your computer and use it in GitHub Desktop.
Sorts and counts all warnings from gcc compilation output
#!/bin/bash
if [ "$#" != "1" ]
then
echo wrong number of arguments
echo Usage: $0 \<filename\>
echo filename - file with build output
exit 1
else
cat $1 | grep "warning:" | sort | uniq -c | sort -nr | awk '{print $0}{total+=1}END{print "Total number of warnings:\n"total}'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment