Skip to content

Instantly share code, notes, and snippets.

@goncha
Created August 30, 2012 16:15
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 goncha/3532090 to your computer and use it in GitHub Desktop.
Save goncha/3532090 to your computer and use it in GitHub Desktop.
Sum numbers in a file
grep -o "[0-9]\+M$" dl.txt | grep -o "[0-9]\+" | awk '{s+=$1} END {print s}'
grep -o "[0-9]\+M$" dl.txt | grep -o "[0-9]\+" | paste -sd+ | bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment