nix, shell, perl, php, mysql and mac os x tips and tricks

Friday, September 19, 2014

Convert raw (batch) mysql command-line output to CSV

mysql --user=wibble --password wobble -B -e "select * from vehicle_categories;" | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g" > vehicle_categories.csv

No comments:

Post a Comment