As colucix said. sed commands are always applied to the current contents of the pattern buffer. One line is taken a time into this buffer (minus the delimiting newline), the commands in the expression are applied to it, and the modified contents are printed out (unless told not to). Then the contents are cleared and replaced with the next line. address ranges filter which lines get grabbed, but don't otherwise affect the basic processing sequence.
In order to operate on multiple lines at once, and the newline characters between them, you have to tell sed to store more than one line in the pattern buffer at a time. This is accomplished with the N command, and/or use of the hold buffer. "N" tells sed to append the next line of text to the current buffer, separated by a newline. This is the only time there's actually a newline in the buffer to target.
In this specific case you also need some kind of loop or hold buffer action to continue to add new lines until the blank line condition is reached, otherwise it would only process a single newline, then empty the buffer for the next line.
The hold buffer is a separate bit of swap space that can be used for temporary text storage, and there are various commands for appending to/swapping out text with the pattern buffer. sed expressions can get horribly complex with it, and trying to keep straight exactly what it's doing always makes my head hurt.
Read the grymoire link I gave earlier for more details on how it works.
Last edited by David the H.; 02-11-2012 at 04:41 AM.