Skip to content

Instantly share code, notes, and snippets.

@rcanepa
Created August 3, 2016 22:36
Show Gist options
  • Save rcanepa/bea682984b120ed017606caa1bd2e16c to your computer and use it in GitHub Desktop.
Save rcanepa/bea682984b120ed017606caa1bd2e16c to your computer and use it in GitHub Desktop.
Recursively find pattern in files
grep -rnw . -e ".*\.extend" --include=\*.js
-r or -R is recursive,
-n is line number, and
-w stands match the whole word.
-l (lower-case L) can be added to just give the file name of matching files.
More examples
grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"
grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment