Skip to content

Instantly share code, notes, and snippets.

@ps
Created April 20, 2015 19:18
Show Gist options
  • Save ps/97cc54e97e137c43b882 to your computer and use it in GitHub Desktop.
Save ps/97cc54e97e137c43b882 to your computer and use it in GitHub Desktop.
Counting the total number of occurrences of a string recursively
grep -c -r 'import' Python-2.5.4/ | \
awk -F : '{total += $2; print $1, $2} END { print "Total:", total }'
Source: http://stackoverflow.com/questions/884591/grep-recursive-and-count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment