Skip to content

Instantly share code, notes, and snippets.

@youcandanch
Created September 20, 2012 04:14
Show Gist options
  • Save youcandanch/3753951 to your computer and use it in GitHub Desktop.
Save youcandanch/3753951 to your computer and use it in GitHub Desktop.
Dead simple repository reference count
#!/bin/bash
USAGE="usage: refcount.sh [string to check]"
if [[ $# = 0 ]]
then
echo $USAGE
exit 1
fi
count=$(git grep -il $1 | wc -l)
list=$(git grep -in $1 | awk -F: '{print $2 "\t" $1}')
echo "Files containing references to $1 in the repo: $count"
echo
echo "$list"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment