Skip to content

Instantly share code, notes, and snippets.

@jeremybmerrill
Created April 7, 2015 16:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jeremybmerrill/1d058424aca5ebe2eb3d to your computer and use it in GitHub Desktop.
Save jeremybmerrill/1d058424aca5ebe2eb3d to your computer and use it in GitHub Desktop.
export from RDS mysql to a CSV
#
# on mac, replace TABGOESHERE with a tab by typing Ctrl-V then the Tab key
#
mysql -u USERNAME --database=dbname --host=HOST --batch -e "select * from tablename" |
sed 's/TABGOESHERE/","/g'| sed 's/^/"/g' | sed 's/$/"/g' | sed 's/\n//g' > destination.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment