Reputation: 83
I have a csv file which may have empty or blank rows. I want to delete such rows but the problem is that the csv files can be potentially very large. So, I am looking for a way to do it without having to load it in memory.
The solution that works for me is using a DataTable or a StreamReader, but both of them will be using the memory which is not preferable.
Thanks in advance.
Upvotes: 1
Views: 1159
Reputation: 46008
I don't think you can do it without loading the file.
I would use a fast CSV reader/writer from http://www.filehelpers.net - I'm sure you can link writer stream to reader stream so you write as you read and you don't need to load the whole file at once.
Upvotes: 4