Hacker News new | ask | show | jobs
by goodevans 1457 days 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)

1 comments

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.