In the last episode (Jun 25), Paul Stewart said:
> Hi there.. I have a copy of the DMOZ database loaded onto a computer
> in Mysql. I'd like to export a certain portion or the entire thing
> (either way is managable but certain portion works better for me) to
> a comma delimited file.
> Granted that I know the names of the fields I want to export, can
> someone tell me how to do this hopefully simple task?
If you know there are no commas in any fields, the quickest way is
mysql -r --skip-column-names -e "select * from table" database | tr "\t" ","
If you can handle a tab-delimited file, just omit the tr command. If
you absolutely need comma-delim and there might be commas in the fields
(but you know there are no quotes), try:
mysql -r --skip-column-names -e "select concat(field1,'\",\"',
field2,'\",\"',field3) from table" database