title: How to edit and replace a group of lines of a text file using c#?
body: <p>I have a large text file(20MB), and I'm trying to change every <em>4th</em> &amp; <em>5th</em> line to <code>0,0</code></p>
  
  <p><img src="https://i.stack.imgur.com/uy5x1.png" alt="enter image description here"></p>
  
  <p>I've tried with the following code but I will be interested to know if theres any better way of doing it..</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>        Power = new List&lt;float&gt;();
          Time = new List&lt;float&gt;();
  
          string line;
          float _i =0.0f;
          float _q =0.0f;
          int counter = 0;
          StreamReader file = new StreamReader(iqFile2Open);
          while ((line = file.ReadLine()) != null)
          {
              if (Regex.Matches(line, @"[a-zA-Z]").Count == 0)
              {
                  string[] IQ = line.Split(',');
                  if (IQ.Length == 2)
                  {
                      _i = float.Parse(IQ[0]);
                      _q = float.Parse(IQ[1]);
                      double _p = 10 * (Math.Log10((_i * _i) + (_q * _q)));
  
                      if((counter%4)==0 || (counter%5)==0)
                          sw.WriteLine("0,0");
                      else
                      sw.WriteLine(string.Format("{0},{1}", _i, _q));
  
                      counter++;
                  }
              }                
          }
  </code></pre>
  
  <p>Thanks in advance.!</p>