By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,938 Members | 1,579 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,938 IT Pros & Developers. It's quick & easy.

Remove Lines in a text file

P: n/a
a
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
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

"a" <a@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
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

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.