Mass-renaming MySQL tables with simple bash scripting
Sunday, April 2, 2006 10:49:53 AM
I found out more about stripping from bash variables at IBM's developerworks, written by Daniel Robbins.
~ $ mysql espressopunkt --exec "SHOW TABLES;" > tables.txt #CAVEAT: Rremove additional line at top. THere's probably an automated way for that but this post already tales longer than the task, so why bother...
~ $ for t in `cat tables.txt`;do echo $t;_t=${t#kaffeeweb_};echo $_t;mysql espressopunkt_dev --exec "ALTER TABLE $t RENAME $_t";done

