title: The Concept of 'Hold space' and 'Pattern space' in sed
body: <p>I'm confused by the two concepts in sed: hold space and pattern space. Can someone help explain them?</p>
  
  <p>Here's a snippet of the manual:</p>
  
  <blockquote>
  <pre><code>h H    Copy/append pattern space to hold space.
  g G    Copy/append hold space to pattern space.
  
  n N    Read/append the next line of input into the pattern space.
  </code></pre>
  </blockquote>
  
  <p>These six commands really confuse me.</p>