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

Processing CSV Files...

P: n/a
Hi,

As strange as it sounds, i need to convert a csv file from one csv layout to
another!...

Basically both have fields as the first line (terminated with a lfcr) but
after that the source file is pretty much continuous with a few lfcr's
through the file..

The output csv i require needs to have a "EOLEOL" at the end of each line
entry...

can anyone help me with the source code for this.. im using the free vb
express 2005.

Thanks
Jul 13 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Ian Craig Armitage" <cr***@icarmitage.co.ukwrote in
news:ul**************@TK2MSFTNGP04.phx.gbl:
Hi,

As strange as it sounds, i need to convert a csv file from one csv
layout to another!...

Basically both have fields as the first line (terminated with a lfcr)
but after that the source file is pretty much continuous with a few
lfcr's through the file..

The output csv i require needs to have a "EOLEOL" at the end of each
line entry...

There is a project called "FileHelpers" on SourceForge which handles CSV
files. The project was a little buggy, but it has some nice helper
functions for CSV.
Jul 13 '07 #2

P: n/a
If the only thing changing is the end of line marker, do the following:

dim fIn as new IO.StreamReader("source.csv")
dim fOut as new IO.StreamWriter("target.csv", False,
System.Text.Encoding.ASCII)

do while not fIn.EndOfStream()
fOut.Write(fIn.ReadLine() & "EOLEOL") ' Note that the write is not a
writeline - you are specifying the end of line marker.
loop
fIn.Close()
fOut.Close()

Mike.
"Ian Craig Armitage" <cr***@icarmitage.co.ukwrote in message
news:ul**************@TK2MSFTNGP04.phx.gbl...
Hi,

As strange as it sounds, i need to convert a csv file from one csv layout
to
another!...

Basically both have fields as the first line (terminated with a lfcr) but
after that the source file is pretty much continuous with a few lfcr's
through the file..

The output csv i require needs to have a "EOLEOL" at the end of each line
entry...

can anyone help me with the source code for this.. im using the free vb
express 2005.

Thanks


Jul 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.