title: Change the header in a huge file without rewriting the whole file
body: <p>I got a problem with huge data files. The headers of these files count 79 lines. After these lines the data is binary. I want to change the header via bash script. I used sed until now. The problem is that when i just want to change the header, either the whole data file is read and written (1) or the process is aborted after those 79 lines (2). I need to change the header in 8 lines. Therefore my commands referring to that problem are:</p>
  
  <p>(1)</p>
  
  <pre><code>sed -i  '1,79 s/ConverterPositionM2C1='"$M2C1"'/ConverterPositionM2C1='"$M2C1N"'/' $FileName
  </code></pre>
  
  <p>(2)</p>
  
  <pre><code>sed -i -e '79q' -e 's/ConverterPositionM1C2='"$M1C2"'/ConverterPositionM1C2='"$M1C2N"'/' $FileName
  </code></pre>
  
  <p>Using the first command works in all cases but it takes hours for huge files (20GB). Because i want to change parameters in 8 lines, which differ from each another, I need to put 8 of these commands in my script and the execution of the script takes even longer.
  The second command only copies the header. The data is lost.</p>