Last active
January 26, 2017 18:22
-
-
Save bsa7/7ccb27a324731835d11fff90976f15fb to your computer and use it in GitHub Desktop.
recursive grep with exclude node_modules and .git folders
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
#!/bin/bash | |
echo " | |
" | |
header="recursive search \"$1\" в \"$PWD\", exclude dirs ./node_modules and ./git" | |
header_row=$(sed 's/./-/g' <<< $header) | |
echo $header_row | |
echo $header | |
echo $header_row | |
echo " | |
" | |
grep -r -n -P $1 . | grep -v -P "node_modules|git" | grep -P $1 --color=auto | |
echo "Search completed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead write
grep -r -p 'search_text' . | grep -v -P 'node_modules|git'
in each search use:nodegrep 'search_text'