Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ntedgi/4b3436df0e3f668961a457913850ca84 to your computer and use it in GitHub Desktop.
Save ntedgi/4b3436df0e3f668961a457913850ca84 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