We Recommend

bash Cookbook: Solutions and Examples for bash Users bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.


Posted By

Leech on 10/03/08


Tagged

mysql dump csv export execute


Versions (?)


Execute MySQL query from console and export to CSV


Published in: Bash 


URL: http://www.cpanelconfig.com/tips/mysql-execute-query-from-console-and-export-to-csv/

  1. mysql –database=database –execute=”select a from b where a>1;” | sed ’s/\t/”,”/g;s/^//;s/$//;s/\n//g’ > filename.csv

Report this snippet 

You need to login to post a comment.