To delete all branches on remote that are already merged:
git branch -r --merged | grep -v master | sed 's/origin\//:/' | xargs -n 1 git push origin
In more recent versions of Git
git branch -r --merged | grep -v master | sed 's/origin\///' | xargs -n 1 git push --delete origin
UPDATE (by @oliver; since does not fit in comment, but enough answers already): if you are on branch ABC then ABC will appear in the results of git branch -r --merged
because the branch is not specified, so branch defaults to current branch, and a branch always qualifies as merged to itself (because there are no differences between a branch and itself!).
So either specify the branch:
git branch -r --merged master | grep -v master ...
OR first checkout master:
git checkout master | git branch -r --merged | grep -v ...