I'm amazed, after 12 years of using Emacs, I still discover new things every week. This week, I learned about M-x occur in a blog post entitled Can your editor do this?.
To use it, go:
And then give it a regexp. I had a buffer with instructions for setting up one of my Ruby on Rails projects, and I wanted to find all the lines that referred to piston, so for the regexp, I typed:
I often use
which is great, it lets you run grep from inside Emacs, and gives you a lot of useful functions, for example, if you press C-c C-c on a line in the grep buffer, Emacs helpfully loads the file for you and jumps to the correct line in the file.