Sunday, January 25, 2009

bash: using find plus grep command

The problem is to scan all files of some name (.e.g. *.css) and to find only those that contain specific string (e.g. 702px). find ./ -name "*.css" -exec grep '702px' {} \; -print
The command finds all .css files that contain string "702px".

1 comment:

  1. Why not just this?

    grep -Rl '702px' --include='*.css' .

    ReplyDelete