getting data out: mysql -> csv

Ian Petersen ispeters-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Tue May 29 21:15:49 UTC 2007


On 5/29/07, Emma Jane Hogbin <emmajane-MHIYrZpDPrNWk0Htik3J/w at public.gmane.org> wrote:
> how do you get HTML fragments (especially
> when there are new lines, tabs and quotes as part of the data) out of a
> MySQL table and into a CSV?

There are probably lots of ways to do it, but my choice would be to
write a script in Ruby to connect to the database and output CSV to
stdout.  Ruby has a CSV module that supports escaping characters and
so on.  If you like, you could even use ActiveRecord to connect to
your database, but that might be overkill.  There's probably an
equivalent way to do it in Perl but I'm not familiar with it.

Ian

-- 
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list