Xmodulo posted a tutorial about searching text files
For a system admin or a programmer, grep and the likes are probably the most popular tools when it comes to searching through complex configuration directories and large trees of source code for a particular text string or pattern.How to search text files for patterns efficiently
If grep is one of your favorite tools, chances are that you will like ack even better. ack is a Perl-based command-line utility similar to grep, but designed to improve the search speed and capabilities of grep. Especially if you are a programmer, I strongly recommend replacing grep with ack. The usage of ack is heavily optimized for code search, so a programmer like you can perform complex search on source code trees with fewer keystrokes.