Use grep to search certain content in the specified sub-directory.
reference url:
reference url:
From: http://www.ai7.org/wp/html/653.html
grep -r abcd *.py
Use above command can not get the expected result
grep -r abcd *
Use above command the result is too big,and also is not expected.
Best method is:
find . -name *.py|xargs grep asdf
another method is below:
find . -iname ‘*.cc’ -exec grep -nH ‘{}’ \;
this method is too complicated.