码迷,mamicode.com
首页 > 数据库 > 详细

批量查询sql脚本

时间:2017-11-01 18:15:15      阅读:278      评论:0      收藏:0      [点我收藏+]

标签:ken   set   sele   批量   word   远程   查询   his   ppa   

远程批量查询sql脚本
for i in {1..50}
do
sql_ip=172.168.0.${i}
 
information=`mysql -h ${sql_ip} -uroot -ppassword dbname -e ‘select name,value from setting where name = "name" UNION select name,value from setting where name = "code" ‘ |grep -v val
ue|awk -F ‘ ‘ ‘{print $2}‘|awk -F ‘\\‘ ‘{print $3}‘`
 
echo ${information} > information.txt
code=`cat information.txt`
token_tab=`mysql -h ${sql_ip} -uroot -ppassword dbname -e ‘select name,value from setting where name = "token"‘|grep -v value|awk -F ‘\\‘ ‘{print $3}‘`
echo ${token_tab} > token_file.txt
sed ‘s/0//g‘ token_file.txt > token.txt
token=`cat token.txt`
echo "${token} this name is "${code}"" >> integ.txt
done

批量查询sql脚本

标签:ken   set   sele   批量   word   远程   查询   his   ppa   

原文地址:http://www.cnblogs.com/musen/p/7767717.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!