In Emacs how do I edit multiple points at once?
Emacs Rocks! describes mark-multiple, which does what you want. (Here's their video introduction.)
EDIT: @Lifton points out it has been superceded by multiple-cursors.
In addition to Juancho's answer, I've used Steve Yegge's multi-select
for your purpose. Example usage (the first example will provide what I think you want):
C-u C-M-m w foo <RET> <RET>
- inserts/prepends "foo" to every multi-selection (you can also append or replace text)
C-u -1 C-M-m r <pre>\(\w+\).+\s-+\(.+\)</pre>
- selects first and last word of the contents every <pre> tag
(provided the contents don't span multiple lines)
C-M-m x M-x upcase-region
- converts all multi-selections in buffer to uppercase
C-u M-w C-q C-j --- C-q C-j <RET>
- saves all multi-selections to kill-ring as a single item,
with selections separated by "---" on a line by itself