blahg

computers are hard, let's go shopping

Recursive grep done right

I end up opening grep’s man page every time I need an option that I haven’t used in a week, so now I’m making a note to myself about something that took me a few minutes to figure out:

grep -H -n -r —include=”*.py” “<what I’m looking for>” .

The pattern has to go after the other options, even when you prefix it with -e . Or maybe it’s just that the —include option only works when you put it right after the -r option. And note that it apparently doesn’t take a regex in the same form as the pattern option — I’m using “*.py”, not “.*py$”. -H shows file names, -n shows line numbers.