I want to export results of a sql query to a CSV file (comma delimited ) using unix scripting. Please help
1 Answer
Try this (soource: Export Data From Database to CSV File)
mysql -u user -p pass database -B -e "select * from
\'person\';" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > filename.csv