title: How to quickly add a line to all html files after a line with a given string
body: <p><strong>In Short</strong></p>
  
  <p>Is there some way to bash command line: <code>echo "***some code***" &gt;&gt; "***all files of some type***"</code> right after the line in the files that includes a certain string such as <code>&lt;body</code>?</p>
  
  <p><strong>In Long</strong></p>
  
  <p>I have to add google analytics to a site. Its got an archive of stuff that goes by a few years.</p>
  
  <p>For some recent archived years I just added :</p>
  
  <pre><code>...
  &lt;/head&gt;
  &lt;body&lt;?php if ($onpageload != "") { echo " onload=\"$onpageload\""; }?&gt;&gt;
  &lt;?php include_once("analyticstracking.php") ?&gt;
  ...
  </code></pre>
  
  <p>into the common_header.php file</p>
  
  <p>For some of the early stuff they didn't make a common_header.php file. So, for the folders that manage years that don't have common headers there are alot of html files that need this line:</p>
  
  <p><code>&lt;?php include_once("analyticstracking.php") ?&gt;</code></p>
  
  <p>Is there some way to bash command line: <code>echo "&lt;?php include_once("analyticstracking.php") ?&gt;" &gt;&gt; "*.html"</code> right after the in the file that includes a certain string such as <code>&lt;body</code></p>
  
  <p>The site is managed with php, python, and html (with some javascript css etc).</p>
  
  <p>I am on ubuntu. Also <strong>note</strong> I am newer to this kind of webpage so if my question is somehow a wrong or a stupid question, please just let me know.</p>