Skip to content

Instantly share code, notes, and snippets.

@pulkitsinghal
Last active January 3, 2018 18:47
Show Gist options
  • Save pulkitsinghal/e634c08490432600c78bff561d887674 to your computer and use it in GitHub Desktop.
Save pulkitsinghal/e634c08490432600c78bff561d887674 to your computer and use it in GitHub Desktop.
combine find and grep
# (a) ignore certain folders
# like: `node_modules, .cache, .cordova, .heroku, .a127, .npm` etc.
# (b) look in package.json only
# (c) find case-insensitve matches to the word: commit
# (d) `-o` means "OR" ... for example, given: `expr1 -o expr2`, expr2 is not evaluated if expr1 is true.
find ~/ \( \
-name node_modules \
-o -name '.cache' \
-o -name '.cordova' \
-o -name '.heroku' \
-o -name '.a127' \
-o -name '.npm' \
\) -prune \
-o -name "package.json" -exec grep -i --color -Hn "commit" {} 2>/dev/null \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment