awk system函数 调用sql语句
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