i need your kind help.
i need to format below lines into CSV format, file size in MB ~4MB.
--------------
*** ALARM
ENABLED
(41431) 7409 EXTERNAL AL 9
COMMERCIAL POWER FAILURE
... CANCEL
ENABLED
(41431) 7409 EXTERNAL AL 9
COMMERCIAL POWER FAILURE
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abdullah DhiabPosted Jan 5, 2015, 9:43 AM
-------------
Abdullah DhiabPosted Jan 5, 2015, 8:29 AM
file is ~50,000 lines and there are 22files
parsing will take long time, i dont know how to optimize it?
Wim SturkenboomPosted Jan 5, 2015, 4:59 AM
Anyway, it looks like fixed-width fields and you can use the TextFieldParser class to parse the fixed width lines.
Next you can write the resulting fields to file using one of the many csv code samples on the web; my favorite is the one by Andreas Knab (write: http://knab.ws/blog/index.php?/archives/3-CSV-file-parser-and-writer-in-C-Part-1.html, read: http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html)