Sunday, June 27, 2010

Finding in files

Finding a string in files is useful and not that straightforward. But don't despair, we have bash.

find . -exec grep -q 'foobar' '{}' \; -print

This searches in the current directory including its subdirectories and finds files that contain foobar.

1 comment: