The basic form is:
ack --type=js -f app/views/ | xargs sed -i '' -e 's/search/replace/'I use ack to generate list of files on which I want to perform the search/replace, and then sed does the actual work. It helps to run this on a clean working directory so I can use git diff to examine the results and git checkout -- . to undo everything and try again if I screw everything up.
Here is another way I've been doing this lately: