功能:向awk传递多个参数,执行同样的步骤—>查找计数
#!/bin/bash
# 以下两种方式都可以传递awk参数
test1="hello"
test2="world"
echo |awk -vt1=$test1 -vt2=$test2 'BEGIN{print t1" "t2}'
echo ${test1} ${test2} | awk '{print "'$test1'","'$test2'"}'
# ================================================
# params="1066339 6197207 01601510 2389011"
# for param in $params
for param in `cat /tmp/hid.tmp`
do
echo $param
# 双引号单引号${变量}单引号双引号【英文符号】
awk -F"\t" '{if($2=="'$param'") {print $0}}' hotel_info_customer_comment_result | wc -l
done
但是上面的脚本只能采用这种方式。
以后找到其余的方式会继续补充,也欢迎各位补充,谢谢