Remove Lines in a text file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to remove specific lines from text files.

I need to always remove lines 1 thru 8 and lines 10 and 11 from text files.

Seems like a simple task, but I'm not getting it.

I'm reading the file via webresponse as a stream and then trying to remove
the lines before parsing it and then writing it to an sql table.

Any ideas on how I can accomplish the line removal/deletion?

Thanks,

Paul
 
string[] lines = myString.Split(Environment.NewLine)

now you have the lines, just choose and join the ones you want
Maybe there is a more optimal solution for this, but this should work fine.
 
Back
Top