有个文件name.txt,每行一个名字,无空格
--------------
formatfocx
simon
zhang
zhou
chen
...
--------------
想写个SHELL,读这个文件,然后MYSQL里运行:select * from user where name = 文件里的每一行
最后结果写以名字命名的文件
formatfocx.txt
simon.txt
zhang.txt
...
请大家帮帮忙,急,在线!
...全文
3005打赏收藏
Shell脚本读文件运行SQL,然后写出结果。
有个文件name.txt,每行一个名字,无空格 -------------- formatfocx simon zhang zhou chen ... -------------- 想写个SHELL,读这个文件,然后MYSQL里运行:select * from user where name = 文件里的每一行 最后结果写以名字命名的文件 formatfocx.txt simon.txt zhang.txt ... 请大家帮帮忙,急,在线!
while read data; do
export TTT="$data"
echo "deal with key word" [$TTT]
SQLRUN=`mysql_opt smp "select * from user where name ='$TTT');"`
echo $SQLRUN > $TTT.txt
done < data.dat