There are lots of ways to find words and phrases within text files. You can use Spotlight, of course, and then open those files with a text editor such as TextEdit or Bare Bones Software’s free TextWrangler. Or if you’re Terminally inclined, you can open and search text files in vi, nano, or emacs. But here’s an alternative you may never have considered: Safari.

Apple introduced an enhanced find mode in Safari 3. When you search for words on a web page, Safari turns the background grey, highlights all matching words against a white background, and shows the currently selected match against a bold yellow background. These visual cues make it easy to spot all of the matches on a page while keeping the surrounding text readable.

But who says you have to use these sweet find features only on a web page? Safari can also handle most plain-text files (those created in plain-text mode with a program like TextEdit). In Safari, select File➝Open File to launch the document. If Safari doesn’t recognise your file, locate it in the Finder, press and hold c-alt, and drag the document onto Safari’s Dock icon.

Once Safari has opened the file, press c-F, enter your search terms, and enjoy the result (see ‘Safari search’, below left). Pressing c-G highlights the next match, and c-shift-G moves to the previous match.

There are some limits – Safari is not happy about opening multi-megabyte files, and if it finds more than 100 matches for your search term, it will not highlight them all at once. While Safari’s find mode can’t replace Spotlight’s or TextWrangler’s powerful search capabilities, it could come in handy if you need to quickly run a simple search on a text file.