On 04-May-01 [EMAIL PROTECTED] wrote:
<random snipage ahead>
> Hi Paul,
>
> I am now confronted with another problem. I need to also provide a CSV
> version.
> I need to use , seperated and " protected text. I have a copy of phpMyAdmin
> that will
> export to this format, but I need to use this at the shell.
> I haven't yet dug into the script to se if this done with PHP or MySQL. I am
> thinking it is probably done with PHP.
> I noticed a mention of MySQL being able to set a delim in the docs but alas
> they never actually say how.
> Finally, I considered using awk for this but I am running into a problem
> there as well
> since "'s are used to protect text. For instance
> awk '{print """$1""","""$2"""} would print the fields correctly if not for
> the " issue.
>
> A shove in the right direction would sure be appreciated.
I'm not Paul, but here's my shove:
localhost.dread$ cat csvdmp
#!/bin/sh
if [ $# -eq "2" ]
then
mysqldump -t $1 $2 | grep INSERT | \
sed 's/^INSERT .* VALUES (//g' | \
sed 's/);//g'
exit $?
fi
me=`basename $0`
echo usage: $me database table
exit 2
----
most import utilities can handle single quotes.
Regards,
--
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php