On Mon, 24 Jun 2002, Phil Schwarzmann wrote: > I want to copy the structure of a table to a brand new table, but I > don't want to use phpmyadmin or some other program. I'm looking for the > command line code. > > Anyone have a link to where I can find it? Or, anyone wanna send me > the code?
Here you go: me@mybox> clone_table.sh tablename newtablename database where clone_table.sh is an executable file containing this: -------------------------------------------------- #!/bin/sh # table clone hack, no warranty, public domain echo "show create table $1;" | mysql -E $3 \ | sed -e "1,2d" -e "s/^Create Table: //" \ -e "s/TABLE \`$1\`/TABLE \`$2\`/" | mysql $3 --------------------------------------------------- Have fun! Thomas -- mysql,query --------------------------------------------------------------------- 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