title: How to replace arrays in file using bash?
body: <p>I have a file like this:</p>
  <pre class="lang-sh prettyprint-override"><code># [...]
  
  ver=1.0
  source_x86_64=(&quot;file-$ver.tar.gz&quot; &quot;file-$ver.tar.gz.sig&quot;)
  source_i386=(&quot;file-$ver.tar.gz&quot;)
  sha256sums_x86_64=(&quot;54842def55267131a12494cd6d23243df1fa3eee60dd418f0a84737f1feafc28&quot;
                     &quot;SKIP&quot;)
  sha256sums_i386=(&quot;c453479cbada5139cc3f494f9e72f192451780c7d936d7aa15be99c48deb4237&quot;)
  
  # [...]
  </code></pre>
  <p>I need to update the hashes each time a new version is released. I can run a program that downloads the three files and generates the sha256sum for each of them:</p>
  <p>For instance <code>makepkg -gA</code> with &quot;ver=1.1&quot; outputs</p>
  <pre class="lang-sh prettyprint-override"><code>sha256sums_x86_64=('82cfaef1f73748a0f814dd06eee3af1fd34232d6dc49421a13176255fed24845'
                     'SKIP')
  sha256sums_i386=('7324bed84c99eb51aa7d639d7c087154291f27e9f494f3cc9315adabc974354c')
  </code></pre>
  <p>How I can overwrite the arrays in the original file, possibly keeping the same position, without appending the program output to the end and deleting the original arrays?</p>
  <p>Note that the first array spans multiple lines and that arrays in the file may differ in size from the ones in the program output (e.g. if a file has been added to the source array and the hash array in the file has not been updated accordingly).</p>