Gossamer Forum
Home : Products : DBMan : Installation :

comma seperated values

Quote Reply
comma seperated values
hello there! i'm new here. :) no on to my question.

i've searched the board but couldn't find anything in reference to my problem. i have several existing csv files. i got one to show up using dbman, but there were some fields that had commas in the body.
i.e., my line would look like this:
"blah blah, blah. blah blah, and stuff."

dbman would read the " 's instead of noticing them as enclosures and then drop the 'blah. blah blah' to the next field and the 'and stuff' to yet another one.

any help on this would be appreciated. if i convert all of my inner commas to ~~ like dbman does, then it won't display the way i am currently displaying. plus, well, i have a lot of csv files that i'd be changing by hand.

thanks. :)
Quote Reply
Re: [jonelin] comma seperated values In reply to
My personal experience has been to pull the comma-delimited, quote qualified files into MS Excell or other db program/spreadsheet (lotus approach, etc) and then re-export as pipe delimited | or as tab-delimited and then search and replace tabs with pipes.

Perhaps someone else will have an easier solution, but this is how I've done it.

Good luck!

Quote Reply
Re: [jonelin] comma seperated values In reply to
we already have a script in place that reads and displays csv's through search strings into our own templates. i'm constrained in the time i can spend in reworking an entire new system.

thanks anyway. :)
Quote Reply
Re: [jonelin] comma seperated values In reply to
Sounds like the perfect job for Perl. Perl is adept at opening, reading, translating and writing text files. I thought you only had one or two csv files so that's why I suggested the Excel method.

My head is in a fog right now (snork, snork <-- that's me trying to breathe with a cold) or I'd offer to hack out a script for you. You basically need a script to: open the file, replace "," with | and replace ,x,x, with ~~ and then write the data out to default.db so you don't have to rename anything.

Is that close to what you need? Do you have any number fields (1,000.00 for example)?

If time is really crucial, then you may want to post a request in the paid mod's section. I'm sure someone could bust one out for you 'post haste'.

Good luck, I hope this will help you.