Program to search for text within files?

Discussion in 'Mac Basics and Help' started by -mattias-, Sep 26, 2012.

  1. -mattias- macrumors member

    Joined:
    Dec 11, 2009
    #1
    I'm looking for a document on my Mac, but I don't know where it is and I cannot remeber the name or anything, only some of the text inside.

    So I'm looking for a program, that can search for a phrase or something of text inside documents through all my documents on my harddisk.
     
  2. lshaner macrumors regular

    lshaner

    Joined:
    Mar 7, 2007
    #2
    Are you saying that the Mac's built-in Spotlight feature doesn't find the doc?

    You could open a terminal and use a combination of find and grep to get potential matches.

    $ find ~ -type f -exec grep -i 'your exact phrase' /dev/null {} \;

    The /dev/null part is just a trick to get the filenames to always print, even though each grep is really against a single file. Or if you used grep -l (ell) then it would show only the filenames with matches and you could leave the /dev/null off.

    Sorry, it won't likely find matches in documents stored in compressed or binary form. You might find a few more hits with 'strings' instead of grep, but then it won't be case insensitive like grep -i.
     
  3. old-wiz macrumors G3

    Joined:
    Mar 26, 2008
    Location:
    West Suburban Boston Ma
    #3
    Ah..the good old days of *NIX commands.
     
  4. Tumbleweed666 macrumors 68000

    Joined:
    Mar 20, 2009
    Location:
    Near London, UK.
    #5
    Have you tried Spotlight? If not, CMD SPACE then type the word you know is in the doc
     
  5. mankar4 macrumors 6502a

    mankar4

    Joined:
    Aug 23, 2007
    Location:
    USA
  6. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #7
    In Finder, you can search for your search terms in file names or in file contents. No other app is required.
     

Share This Page