Skip to content

Instantly share code, notes, and snippets.

@AmmarCodes
Created November 21, 2018 12:01
Show Gist options
  • Save AmmarCodes/87c63d78810b2ed53688f4d7680f1bfd to your computer and use it in GitHub Desktop.
Save AmmarCodes/87c63d78810b2ed53688f4d7680f1bfd to your computer and use it in GitHub Desktop.
USERNAME=
PASSWORD=
DBNAME=
QUERY_FILE_NAME=
mysql -u $USERNAME -D $DBNAME -p$PASSWORD -B < $QUERY_FILE_NAME | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > $QUERY_FILE_NAME.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment