I have some directories with names like "mm-yyyy" (01-2014) in current directory. I want to grep the files in directories whose names have "2013". How can I exclude directories whose names don't have "2013"? I tried the following but it didn't work:
grep hill * -R --exclude-dir=*201[0-2]
you could use
grep -R hill *-2013
--exclude-dir should work, too:
grep -R hill --exclude-dir=".*201[0-2]" .
without the quotes the asterisk would be expanded by bash. Additionally the wildcard for regular expressions is
. - matches any character * - match any number of repetitions of the previous character, including none