unix - How to grep files under a pattern path -


let's there following tree of directories:

foo/    +bar/    |   +view/    |   |    +other/    |   |          +file.groovy    |   |    +file2.groovy    |   |    +file.txt    |   +file3.groovy    +xyz/        +view/             +file4.groovy        +file5.groovy 

and want grep method on groovy files directory either view or under view (that file.groovy, file2.groovy , file4.groovy).

i'm trying using --include=.*\/view\/.*\.groovy far know regex anything , / character , word view , / character , , word .groovy

but doesn't return anything.

isn't there way of doing using include option?

specifying -path option find should work:

find foo/ -path "*/view/*" -name "*.groovy" -exec grep method {} \; 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -