-
-
Save danielmwai/5782f0dcc5eae798f2f993923a793d61 to your computer and use it in GitHub Desktop.
Finding files with specific text recursively using grep - unix
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
#!/bin/bash | |
# without regex pattern | |
grep --recursive --include=\*.java -nHIi "utf-8" /my/dir | |
grep --recursive --include=\*.{java,xml} -nHIi "utf-8" /my/dir | |
# with regex pattern | |
grep --recursive --include=\*.{xml,java,jspx} -nHIiE "(utf-8|iso8859-1|windows-1252)" /my/dir | |
## | |
## keep the a comma (,) when searching through a single file extension. ie: {,xml} | |
grep --recursive --include=\*.{,java} -nHIi "utf-8" /my/dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment