Librarium Whitehat
Blog Pics
"Inveniam viam aut faciam" : I will either find a way, or I shall make one

Adeptus-Mechanicus - BlogMe

Quick MYSQL tip

Using mysql from the command line is very useful. It allows one to plugin mysql queries and responses into a shell script. This is a good thing. The problem that arises though is the output. When you get the response it is delimited with a tab, and this can make it a bit difficult to work with in shell scripts. So lets use ‘tr’ …

echo “select * from TABLE1′” | mysql -pxxx DBNAME | tr “\011” “:” 

..and that will quite nicely replace the tabs with semi-colons. And that is easier to use in a script.

Published by erich, on August 3rd, 2011 at 3:00 pm. Filled under: linuxNo Comments

No comments yet.

Leave a Reply