Quick one-liner to export from a DB to CSV
We recently received some data in an sqldump that we wanted in CSV format.
Here's how you can use sed to tranform it into CSV (from here). This should all be one line...
mysql -u user -p dbname -B -e "SELECT * from table;" |
sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > filename.csv
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment