I was thinking about my last entry and perhaps this one should have come first to make thing clearer. I was trying to show the use of sed for solving a problem. I wanted an example that was complex but still understandable. I was looking for a way to show how to explain the use of pattern and hold buffers in sed. I don't think that's what I got.
The pattern buffer contains the current line. It's what the "s" command performs its replacements to. The hold buffer is another buffer you can use. There are 5 commands (g G h H x) that move thing to and from the hold buffer. You can choose between appending to a buffer or overwriting the buffer. H appends the pattern buffer to the hold buffer, h overwrites the hold buffer with the pattern buffer, G appends the hold buffer to the pattern buffer, and g overwrites the pattern buffer with the hold buffer. x exchanges the hold and pattern buffers