title: Finding and replacing a line in a .csv file
body: <p>What i am trying to do is get the number of files in a specific directory and add that in .csv file with the computer name. (which is done). What i can't do is read the file first, if computer name already exists, it should change the corresponding values.
  There are five fields in .csv file. I want to find and replace the rest of the changed values on the basis of first field i.e. the name of computer.</p>
  
  <p>Is there a way to probably make a search pattern to replace. </p>
  
  <pre><code>        if (File.ReadAllText(filepath).Contains(compName))
          {
              var s = File.ReadAllText(filepath);
              s = s.Replace(compName, fileText.ToString());
              File.WriteAllText(filepath, s);
          }
         else
         {
              File.AppendAllText(filepath, fileText);
         }
  </code></pre>