Created
November 14, 2012 09:40
-
-
Save hpatoio/4071244 to your computer and use it in GitHub Desktop.
Export custom MySQL query to CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hpatoio@namazu:~$ mysql -uroot -h HOSTNAME -p DATABASE_NAME -B -e "select field1,field2 ... fieldX from \`TABLE_NAME\`;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > my_export.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment