Export Mysql result as CSV
Don’t ask me how the sed magic works, but it does. Taken from here.
Running this:
mysql -u<USER> -p<PASSWORD> <DATABASE> -B -e "select * from videos_video;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g'
will produce something like this:
"id","title","url" "1","video 1","http://youtube(...)" "2","video 2","http://youtube(...)" "3","video 3","http://youtube(...)"
Just pipe it to a .csv file and you’re done
Related:
- How to export HD video for the web As some of the people who know me are aware,...
- Video speed controls on youtube’s HTML5 player I don’t know if you noticed, but youtube introduced speed...
Categorised as: computers, findings, software development, tips