how to save the output of a mysql query to a file code example
Example: mysql query result to file
mysql -user -pass -e "select cols from table where cols not null" > /tmp/output
mysql -user -pass -e "select cols from table where cols not null" > /tmp/output