Comment by goodevans

4 years ago

Find all .txt files containing the word 'foo': find ./ -mount -type f -name "*.txt" -exec grep -iHn 'foo' {} \;

(the -mount stops it traversing into mounted shares)

With zsh:

  grep -iHn 'foo' **/*.txt(.)

Though I'm not sure how to prevent zsh from descending in to other filesystems, as you can with find.