Skip to content

Instantly share code, notes, and snippets.

@bsa7
Last active January 26, 2017 18:22
Show Gist options
  • Save bsa7/7ccb27a324731835d11fff90976f15fb to your computer and use it in GitHub Desktop.
Save bsa7/7ccb27a324731835d11fff90976f15fb to your computer and use it in GitHub Desktop.
recursive grep with exclude node_modules and .git folders
#!/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"
@bsa7
Copy link
Author

bsa7 commented Jan 26, 2017

Instead write grep -r -p 'search_text' . | grep -v -P 'node_modules|git' in each search use:

nodegrep 'search_text'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment