Skip to content

Instantly share code, notes, and snippets.

@scriptype
Last active March 20, 2017 12:38
Show Gist options
  • Save scriptype/96c2cb131ddfc9080128a52d5e633c58 to your computer and use it in GitHub Desktop.
Save scriptype/96c2cb131ddfc9080128a52d5e633c58 to your computer and use it in GitHub Desktop.
Find usage of a word in the project
function useof {
if [[ -n $1 ]]
then
if [[ -n $2 ]]
then
local dir=$2;
else
local dir=".";
fi
grep --recursive --include="*.js" $1 $dir | awk '{ print $1 }' | cut -d':' -f1 | uniq;
else
echo 'Usage: useof <term> <dir>[optional]’
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment