0

I'm trying to output query results to a csv file. I'm running this currently:

mysql  -u user -p  -e "$Query" --batch --raw |  tr '\t' ','  > file.csv;

The problem is that there are some fields that are a text/description that contains "," (comma), and that's where things get messed up. I tried also to run only with batch/raw but still no luck.

How can I fix this?

khelwood
  • 55,782
  • 14
  • 81
  • 108
  • Does this answer your question? [How can I output MySQL query results in CSV format?](https://stackoverflow.com/questions/356578/how-can-i-output-mysql-query-results-in-csv-format) – kmoser Jun 08 '22 at 04:13

0 Answers0