Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I understand that Spotlight will search the full text of files in any folder and will show files that contain instances of the searched text. But I would also like to see highlighted instances of the searched text within the text file. Command-f in a text editor accomplishes this.

The problem is that I have to perform a two-step process which can be very time-consuming when I have a lot of files to search through:

  1. Use Spotlight to locate files that have instances of the searched text in them
  2. Open each file in a text editor individually, command-f, and locate the instance of the text within that file.

Is there any way of combining these two steps into one on OS X? Is there a feature of Spotlight I am missing or an app that will do this? I can do this quite easily on the iPad with the search bar in Daedalus Touch but would love to find out an OS X equivalent.

Thanks for reading.

share|improve this question

I often do such search, but I do not use fancy GUIs for that. If you are interested, then read on.

Unix has a great tool called grep which will search for patterns within files. It even supports regular expressions if you use egrep.

Example searching the word "hello" with all case mixture in the Dropbox folder:

cd /Users/name/Dropbox
grep -Riw hello *

That is it. Oh, I forgot to mention you have to use the Terminal application before typing these commands.

If you look for two words "hello" or "bye", you can do:

egrep -Riw "hello|bye" *

If you are looking for every words that contains "ell" (such as hello), you can do:

grep -Ri ell *

And finally (but read the manual page if you want more), matching every file that have the word "iOS" with this particular case:

grep -Rw iOS *
share|improve this answer
Thanks. I found the grep tool in my own research. Although I don't like 'fancy' GUIs either, I do prefer GUIs. I don't know what I'm doing in the Terminal app. – DrGuyBH Mar 15 '13 at 1:59
I understand. I can like fancy and non-fancy GUIs, I feel comfortable with all types including command line. So I try to use the easiest tool for each task. I do always have a terminal open ;-) – Huygens Mar 15 '13 at 7:54
up vote 1 down vote accepted

I found an app (paid) that will do the above: SearchInFiles. Disclaimer: I haven't tried it yet.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.