Changing format of a CSV file

G

Guest

My apologies in advance, as this probably isn’t a FrontPage question.
However, it is for my FrontPage site and I don’t know where else to go. If
anyone can suggest a more appropriate forum, I would be happy to post there
instead.

Anyway, here is my question. I need to convert the format of a file. The
file has a number of records, each record having a number of fields. The
fields are separated by semicolons (I believe this is known as a CSV format).
Every record has the same format and the same number of fields. What I need
to do is copy the information from this file to a second file, but changing
the sequence and content of the fields. For example, I would need to do
something like the following:

If field 4 = “Hâ€, set field to "House"; If field 4 = “Aâ€, set field to
“Apartmentâ€

Copy field 5 from first file into field 7 of second file

I need to do this for a large number of files each week. Consequently, I
need a simple bit of SW (either on my computer or on my server) to do this. I
know how to do it manually, but this is far too time-consuming and error
prone.

Can anyone give me some guidance on how to do this (and what would be a
suitable language)? If I had a few lines of code in an appropriate language,
I could likely write the entire program with a bit of help. I would be
willing to pay for the help.

The files in question can be treated as text files.

Doug Stewart ([email protected])
 
S

Stefan B Rusynko

You will need to hand write server side code
(depends on what your server supports)
- If it supports ASP, then you can use FileSystemObject and text streams
(see http://www.w3schools.com/asp/default.asp)

But in the long term you would be better off converting the CSV text files to a DB
(Access will import CSV files)
- where the manipulation would be easier (or perhaps not even needed)

PS
A CSV using ; as delimiter is dangerous if any of your data will also ever have ; in it
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| My apologies in advance, as this probably isn’t a FrontPage question.
| However, it is for my FrontPage site and I don’t know where else to go. If
| anyone can suggest a more appropriate forum, I would be happy to post there
| instead.
|
| Anyway, here is my question. I need to convert the format of a file. The
| file has a number of records, each record having a number of fields. The
| fields are separated by semicolons (I believe this is known as a CSV format).
| Every record has the same format and the same number of fields. What I need
| to do is copy the information from this file to a second file, but changing
| the sequence and content of the fields. For example, I would need to do
| something like the following:
|
| If field 4 = “Hâ€, set field to "House"; If field 4 = “Aâ€, set field to
| “Apartmentâ€
|
| Copy field 5 from first file into field 7 of second file
|
| I need to do this for a large number of files each week. Consequently, I
| need a simple bit of SW (either on my computer or on my server) to do this. I
| know how to do it manually, but this is far too time-consuming and error
| prone.
|
| Can anyone give me some guidance on how to do this (and what would be a
| suitable language)? If I had a few lines of code in an appropriate language,
| I could likely write the entire program with a bit of help. I would be
| willing to pay for the help.
|
| The files in question can be treated as text files.
|
| Doug Stewart ([email protected])
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top