title: VB.Net editing a CSV (or delimited file)
body: <p>I would like to know a way (of course I want to know the best way) to edit a csv file, preferably without having to read the original and write the results to a new one. </p>
  
  <p>Example 1: I want to split the contents of a column into two columns 123abc into 123, abc</p>
  
  <p>Example 2: I want to remove letters from the beginning of a column AB123 into 123</p>
  
  <p>Clarification: I do not need help solving my examples; I just need to be pointed in the right direction of reading and editing the same file.</p>
  
  <p>Here is a code example of using a temporary file that seems to me is too slow</p>
  
  <pre><code>    Dim currentLine as string()
  tempFile.AutoFlush = True
  
  Do Until origFile.EndOfData
      currentLine = origFile.ReadFields
      currentLine(1) = currentLine(1).Replace("ABC","") 'would convert ABC123 to 123
      For index as Integer = 0 to currentLine.Count - 2
          tempFile.Write(currentLine(index) &amp; ",")
      Next
          tempFile.Write(currentLine(currentLine.Count - 1))
          tempFile.WriteLine()
  Loop
  
  tempFile.Flush()
  tempFile.Dispose()
  origFile.Dispose()
  IO.File.Copy(tempFile,OrigFile,True)
  IO.File.Delete(tempFile)
  </code></pre>