Created
January 30, 2012 20:53
-
-
Save alokm/1706626 to your computer and use it in GitHub Desktop.
grep for specific text in a directory recursively
This file contains 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
To search for text in files from the current folder (or directory, to follow Linux nomenclature), one can write: | |
grep "text" -R . -n --include=*.py | |
The parameters are as follows: | |
text the actual text to search for | |
-R Recurse to subdirectories | |
. start from the current directory | |
–include=*.py specifies a regular expression that searchable files must match (e.g. *.py) | |
–color makes the output pretty | |
-n shows the lines numbers of the lines that matched your search text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment