Results 1 to 2 of 2

Thread: Search only text files with 'find' command?

  1. #1
    Junior Member Princessly's Avatar
    Join Date
    Oct 2012

    Search only text files with 'find' command?

    I've been using this to search an entire directory recursively for a specific phrase in my code (html, css, php, javascript, etc.):

    find dir_name -type f -exec grep -l "phrase" {} \;
    The problem is that it searches ALL files in the directory 'dir_name', even binary ones such as large JPEG images. With a directory also containing large number of images dispersed everywhere, it dramatically reduces the efficiency. Sometimes it takes very long to get a response.

    Is there any parameter I can easily use to make it only search text files?
    Live in the fairy tale, Princessly, the valiant store.

  2. #2
    Administrator Kavoir's Avatar
    Join Date
    Dec 2009
    The road goes ever on and on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts