My pasteblog

This is not my Zettelkasten but a durable .bash_history

Mass-renaming MySQL tables with simple bash scripting

,

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

Joomla’s Project Director Talks 1.1Nested sets in MySQL

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.

February 2012
S M T W T F S
January 2012March 2012
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29