Skip to content

Instantly share code, notes, and snippets.

@diodoe
Created February 5, 2011 11:20
Show Gist options
  • Save diodoe/812379 to your computer and use it in GitHub Desktop.
Save diodoe/812379 to your computer and use it in GitHub Desktop.
Export mysql tables in csv with sed
#!/bin/bash
mysql -uexampleuser -pletmein exampledb -B -e "select * from \`person\`;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > filename.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment