title: Appending using sed pattern after certain line number
body: <p>I am using following command to append string after AMP, but now I want to add after to AMP which is after SET2 or line number 9, can we modify this command to append the string only after SET2 or line number 9? And if I want to add to only to SET1 AMPs or before line number 9 , could someone help me with the command, thanks.</p>
  <pre><code>$ sed -i '/AMP/a Target4' test.txt
  $ cat test.txt 
  #SET1
  AMP
  Target 1
  Target 2
  AMP
  Target 3
  Target 4
  Target 5
  #Set2
  AMP
  Target 11
  Target 12
  </code></pre>
  <p>Note there is no line between above text.</p>