Skip to content

Instantly share code, notes, and snippets.

@msiemens
Created January 4, 2013 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msiemens/4452494 to your computer and use it in GitHub Desktop.
Save msiemens/4452494 to your computer and use it in GitHub Desktop.
/^Author:/ {
author = $2
commits[author] += 1
commits["tot"] += 1
}
/^[0-9]/ {
more[author] += $1
less[author] += $2
file[author] += 1
more["tot"] += $1
less["tot"] += $2
file["tot"] += 1
}
END {
totalmore = 0
totalless = 0
totalfile = 0
for (author in commits) {
if (author != "tot") {
totalmore += more[author]
totalless += less[author]
totalfile += file[author]
print author, "inserted", more[author], "and deleted", less[author], "lines over", file[author], "files"
more[author] = more[author] / more["tot"] * 100
less[author] = less[author] / less["tot"] * 100
file[author] = file[author] / file["tot"] * 100
commits[author] = commits[author] / commits["tot"] * 100
printf "%s added %.0f%% and removed %.0f%% of the lines accounting for %.0f%% of the files changed and %.0f%% of the commits\n", author, more[author], less[author], file[author], commits[author]
}
}
print "Total: ",totalmore, "inserted and", totalless, "deleted lines over", totalfile, "files"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment