#/bin/bash
#telno 为查询号码列表文件
#sendsms.log 为短信发送结果文件
#1 代表发送成功
query_sms()
{
>submit_telno
>delivered_telno
>fail_delivered_telno
cat telno |while read line
do
#判断telno 文件里的号码哪些提交成功---保存到submit_telno
awk '{if ($1=='$line') print$0}' sendsms.log >>submit_telno
done
#判断telno文件里的号码哪些发送成功---保存到delivered_telno
awk '{if ($2==1) print$0}' submit_telno >>delivered_telno
#最后判断telno文件里的号码哪些提交失败---保存到fail_submit_telno
awk 'ARGIND==1{a[$1]} ARGIND>1&&!($1 in a){print $0}' delivered_telno telno > fail_delivered_telno
#最后判断telno文件里的号码哪些没有发送成功---保存到fail_delivered_telno
awk 'ARGIND==1{a[$1]} ARGIND>1&&!($1 in a){print $0}' delivered_telno telno > fail_delivered_telno
}
main()
{
query_sms
}
main
exit 0
阅读(1476) | 评论(0) | 转发(0) |