How to edit all files containing a particular string
Note: This post was originally written by David Ketcheson.
It's often useful to be able to automatically open all files with a particular string (say, to rename a variable throughout your code). To do this with ack, and open all files containing my_string in vim, just type:
vim $(ack -l my_string)
It can be accomplished in a similar way with grep instead of ack.
Edit: If you just want to search and replace a particular string in all files under some directory recursively, use