Wednesday, June 22, 2011

use the Unix find command to search through files for a particular word

find [dir] -name [files] | xargs grep [text to search for]

For example,

find . -name “*.v” | xargs grep parity_check

find [dir] -name [files] -exec grep -l “[text to search for]” {} \;

for example

find . -name “*.v” -exec grep -l "parity_check" {} \;