This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Text files are the only ones you'll be able to search reliably using this approach. The other formats are binary, structured files that are not amenable to this kind of simplistic approach.
I'd look into using a search library like Lucene for this, but you'll still need to use particular libraries to get at the contents of those formats, like Apache POI for DOC, XLS and PPT, and PDFBox for PDFs.