title: Inserting contents of one file into another file based on specific string
body: <p>I'm trying to write a bash script that does the following:</p>
  
  <p>1) Read the contents of one file (f1.txt)</p>
  
  <p>2) For each line that starts with "&lt;", but does not contain "start" or "item", insert the entire contents of a second file (f2.txt) in the line after. This change must be done in the original file, f1.txt</p>
  
  <p>For example:</p>
  
  <p>f1.txt:</p>
  
  <pre><code>&lt;start&gt;
    &lt;name1&gt;
      &lt;item&gt;
        stuff
      &lt;/item&gt;
    &lt;/name1&gt;
    &lt;susan&gt;
      &lt;item&gt;
        stuff
      &lt;/item&gt;
    &lt;/susan&gt;
  &lt;/start&gt;
  </code></pre>
  
  <p>f2.txt:</p>
  
  <pre><code>HELLO
  WORLD
  </code></pre>
  
  <p>results, f1.txt:</p>
  
  <pre><code>&lt;start&gt;
    &lt;name1&gt;
      HELLO
      WORLD
      &lt;item&gt;
        stuff
      &lt;/item&gt;
    &lt;/name1&gt;
    &lt;susan&gt;
      HELLO
      WORLD
      &lt;item&gt;
        stuff
      &lt;/item&gt;
    &lt;/susan&gt;
  &lt;/start&gt;  
  </code></pre>
  
  <p>How should I go about solving this? Should I read line-by-line, or even character-by-character?</p>