At 9:04 AM +1100 1/9/01, Mark Dale wrote:
>> > Hello
>>> Could anyone tell me how to select some contents of a table and dump
>>> them as a comma-delimited file.
>>> Mark Dale
>>Read The Fine Manual, look in section 7.19 and read up on
>>SELECT ... INTO OUTFILE ...
>>Carsten H. Pedersen
>>Keeper and maintainer of the bitbybit.dk MySQL FAQ
>It seems this is only possible if you have permissions to write
>files to the server as I get a "permission denied" error message.
>The database table I'm trying to get the file from is hosted at an ISP.
>Is there another method to get a comma-delimited file?
mysql -N -e "your query here" db_name | sed -e 's/ /,/g' > output_file
where the character after the first slash in the sed command is a tab.
You can also use this, though the sytax may vary for different versions
of the tr command:
mysql -N -e "your query here" db_name | tr '\t' , > output_file
Paul DuBois, paul@stripped