Skip to content

Instantly share code, notes, and snippets.

@artursapek
Created January 5, 2013 01:32
Show Gist options
  • Save artursapek/4459073 to your computer and use it in GitHub Desktop.
Save artursapek/4459073 to your computer and use it in GitHub Desktop.
Easier recursive grep
#!/bin/sh
# Grep for a certain filetype recursively.
# Usage:
# gr headerBar html
# => All instances of "headerBar" in html files in this directory.
if [ -z "$2" ]
then
SELECTOR="*"
else
SELECTOR="*.$2"
fi
grep -r --include=$SELECTOR $1 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment