ITeye博客

awk system函数 调用sql语句

wtgame · 2010-12-30 05:10 · shell · 非技术 · Markdown

awk 'BEGIN{system("mysql -u root -p1q2w3e test -Bse \"select * from test where type='\''""A""'\''\"")}'


 

 

awk 的system调用一个sql语句,sql语句中的where条件来自一个file的$1

 

[root@jerome-1 awk]# cat file  | awk '{print $1}'
A

 

echo | awk '{system("mysql -u root -p1q2w3e test -Bse \"select * from test where type='\''"$1"'\''\"")}' file

 


评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。