I tried to use grep to find some code snippets in python files which are spreaded over some directories / subdirectories, but unfortunately my attempts failed :(
grep -r "search-pattern" *.py
should do the magic, but it failed with "no matches found", although there are several files containing lines with the search pattern.
Next I tried the following:
grep -r "search-pattern" .
Which seemed to worked, but also returned many errors for some compiled c-files and stuff. Obviously more than I wanted.
Finally, after many Google searches, I came up with:
grep -rn --include="*.py" "search-pattern"
This did the job and found all python files I was searching for. As a bonus it also prints the line numbers containing the search-pattern.
But one problem remained: some "permission denied" errors. How do I get rid of those? I thought handling grep would be easy but it turned out being complex to get nice results, with line numbering and without errors..
Any help would be highly appreciated :)