title: Insert lines in a file starting from a specific line
body: <p>I would like to insert lines into a file in bash starting from a specific line.</p>
  
  <p>Each line is a string which is an element of an array</p>
  
  <pre><code>line[0]="foo"
  line[1]="bar"
  ...
  </code></pre>
  
  <p>and the specific line is 'fields'</p>
  
  <pre><code>file="$(cat $myfile)"
  for p in $file; do
      if [ "$p" = 'fields' ]
          then insertlines()     #&lt;- here
      fi
  done
  </code></pre>