Skip to content

Instantly share code, notes, and snippets.

@mjj2000
Last active December 18, 2015 17:49
Show Gist options
  • Save mjj2000/5820859 to your computer and use it in GitHub Desktop.
Save mjj2000/5820859 to your computer and use it in GitHub Desktop.
A shell script to do find and grep.
# arg-1: filename pattern for "find"
# arg-2: content pattern for "grep"
# note: If filename pattern contains wildcard, it should be escaped.
# Or the matched files only in the current path will be the result. Other matched files
# will not be included in the result.
# ex:
# > findNgrep.sh \*.php test
#
find . -name "$1" -exec grep -wnH "$2" {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment