title: How to insert a line using sed before a pattern and after a line number?
body: <p>How to insert a line into a file using <code>sed</code> before a pattern and after a line number? And how to use the same in shell script?</p>
  
  <p>This inserts a line before every line with the pattern :</p>
  
  <pre><code>sed '/Sysadmin/i \ Linux Scripting' filename.txt
  </code></pre>
  
  <p>And this changes this using line number range :</p>
  
  <pre><code>sed '1,$ s/A/a/'
  </code></pre>
  
  <p>So now how to use these both (which I couldn't) to insert a line into a file using <code>sed</code> before a pattern and after a line number or another approach?</p>