title: How can a text file be automated converted like this using tools in linux?
body: <p>I have a text file with several lines.</p>
  
  <p>I want to do the following:
  1. Remove the first 14 characters. Leave the next 8 characters. Then delete everything on the line after that.</p>
  
  <p>Then the file looks something like this.</p>
  
  <pre><code>20050013
  AC040020
  AC050024
  </code></pre>
  
  <ol>
  <li>At the beginning of each line, I want to add something like RAM[n] = 'h, where n keeps incrementing. I also want to add a ; at the end.</li>
  </ol>
  
  <p>Then the file looks like this</p>
  
  <pre><code>RAM[0] = 'h20050013;
  RAM[1] = 'hAC040020;
  RAM[2] = 'hAC050024;
  </code></pre>
  
  <p>There has to be 10 entries in the file. So I add remaining entries and set them to 0. The file ends up like this:</p>
  
  <pre><code>RAM[0] = 'h20050013;
  RAM[1] = 'hAC040020;
  RAM[2] = 'hAC050024;
  RAM[3] = 'h00000000;
  RAM[4] = 'h00000000;
  RAM[5] = 'h00000000;
  RAM[6] = 'h00000000;
  RAM[7] = 'h00000000;
  RAM[8] = 'h00000000;
  RAM[9] = 'h00000000;
  </code></pre>
  
  <p>I guess I could use a perl script or vi. How can this process be automated?</p>