Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: