Tuesday, June 9, 2009

Exporting mysql table to csv

bawdo2001 had a nice posting Export from MySQL to CSV for exporting data from MySQL to CSV with some shell commands:
mysql -uexampleuser -ppassword exampledb -B -e "select * from \`person\`;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > filename.csv
The details on the entry.

No comments: