Convert cqb output to CSV file format



Is there a way to convert the output of cbq shell command to a CSV format?

e.g. cbq -q -e http://x.x.x.x:8093 -u “$CBQAdmu” -p “$CBQAdmp” --script “select * from system:completed_requests limit 5” --output test.out

this would generate the output in a jscon format, can we convert this output into a CSV format?



N1QL (cbq shell) outputs into JSON format. You can use external utilities to convert into CSV format


Note that the web-based Query Workbench can export query results in tab-separated format.

On the command-line, a great tool for processing JSON is ‘jq’: