Program to search for text within files?

-mattias-

macrumors member
Original poster
Dec 11, 2009
98
0
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.
 

lshaner

macrumors regular
Mar 7, 2007
154
1
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.
 

Tumbleweed666

macrumors 68000
Mar 20, 2009
1,651
47
Near London, UK.
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.
Have you tried Spotlight? If not, CMD SPACE then type the word you know is in the doc
 

GGJstudios

macrumors Westmere
May 16, 2008
44,365
703
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.
In Finder, you can search for your search terms in file names or in file contents. No other app is required.