• Wincent
    Open
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search

Summing a list of integers with AwkEdit

Created 7/20/2012, updated 5/18/2017

Example: seeing how many commits you were involved in in a Git repo:

$ git shortlog -s | grep you | awk '{s+=$1} END {print s}'

(Assuming your name appears in multiple lines of the git shortlog output, because you paired with various people along the way and so you appear as "you+other@example.com" and "other+you@example.com".)

  • git
  • awk
  • wiki
Site
  • About
  • Blog
  • Wiki
  • Snippets
  • Tags
  • Search
External
  • GitHub
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
Colophon

Made by Greg Hurrell using React, Relay and GraphQL (with help from Git, Redis and Neovim).