[ale] CSV file parser or alternative

Richard Kolkovich sarumont at sigil.org
Sat Aug 5 09:47:20 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/04/06 20:46, Jim Seymour blabbered::
> Hi All,
> 
> I am looking for a way to pull certain row/column values from a csv file
> to save in a text file that I can load into MySQL. I have not seen a
> direct way using MySQL to pull the data and load into the correct
> columns. The file is 15 lines long and is in this format;
> 
> "ABIAX",20.63,"2006-08-03","6:00pm",-0.09,N/A,N/A,N/A,N/A
> "ACEIX",8.78,"2006-08-03","6:00pm",-0.03,N/A,N/A,N/A,N/A
> etc.....
> 
> Basically I need to pull the date value one time and then the fund
> values in series after that and create a text file that can be loaded
> into MySQL through the "LOAD DATA LOCAL INFILE" command. I understand
> there is a commercial product that can do this. I am looking for a
> "free" method for my Debian Etch box. Ideas?
> 
> Thanks,
> 

Depending on how complex you want to get, you can simply construct a
BASH script using cut (with comma as your delimiter) and I/O
redirection.  It could also be done in perl by reading the file line by
line and using split to tokenize the string.

- --

Richard Kolkovich


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE1KFoKTYpNZ5U71kRAhvfAJ9DbhpslSIFWC2oaPjzowxzr8pZ4gCfWl+k
JGZyYCkfGuqJ4clDkmofJXg=
=cuER
-----END PGP SIGNATURE-----



More information about the Ale mailing list