Skip to content

Instantly share code, notes, and snippets.

@ddunkin
Created September 29, 2015 00:49
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 ddunkin/9bc7e2962909b3c8e829 to your computer and use it in GitHub Desktop.
Save ddunkin/9bc7e2962909b3c8e829 to your computer and use it in GitHub Desktop.
ruby sum first column from stdin
ruby -e 'sum = 0 ; ARGF.each_line { |l| sum = sum + l.split.first.to_i } ; puts sum'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment