Skip to content

Instantly share code, notes, and snippets.

@omurphy27
Last active June 13, 2019 07:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omurphy27/0f81bd9ccccf669ceb8f8b1a2268f41d to your computer and use it in GitHub Desktop.
Save omurphy27/0f81bd9ccccf669ceb8f8b1a2268f41d to your computer and use it in GitHub Desktop.
Oh My ZSH Recursive Case-insensitive Grep with common File / Folder Exclusions and Line Numbers - Bash Function and alias shortcut for zshrc file
# add any other filename endings you wish to exclude
function mygrep {
grep -inrF "$1" --exclude-dir={node_modules,vendor,.git,.svn} --exclude=\*.{min.js,min.css,map,swp,swn,swo} . --color;
}
# fire the above function in your terminal by doing the below
# in the directory you wish to recursively grep through
mygrep function_name_to_grep
# or wrap your search term in quotes
mygrep 'string to search for'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment