Last active
December 18, 2015 17:49
-
-
Save mjj2000/5820859 to your computer and use it in GitHub Desktop.
A shell script to do find and grep.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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