执行:t1.sh phone_num.txt
生成文件:
cat a1.txt
select * from t_user_actionlog t where t.visitdate >= to_date('2011-09-01','yyyy-mm-dd') and t.msisdn in (
'13075836025',
'13075836145',
'18606060210')
cat a2.txt
select * from t_user_actionlog t where t.visitdate >= to_date('2011-09-01','yyyy-mm-dd') and t.msisdn in (
'13075836247',
'18605911204',
'13075812112')
cat a3.txt
select * from t_user_actionlog t where t.visitdate >= to_date('2011-09-01','yyyy-mm-dd') and t.msisdn in (
'13110897091',
'13075836149',
'18606999580')
cat a4.txt
select * from t_user_actionlog t where t.visitdate >= to_date('2011-09-01','yyyy-mm-dd') and t.msisdn in (
'18650094591',
'18650094592',
cat t1.sh
#!/bin/awk -f
{
if(NR%3==1) {
n++;
print "select * from t_user_actionlog t where t.visitdate >= to_date('2011-09-01','yyyy-mm-dd') and t.msisdn in (" > "a"n".txt"
}
if(NR%3==0)
print "'"$0"')" >> "a"n".txt";
else
print "'"$0"'," >> "a"n".txt";
}
cat phone_num.txt
13075836025
13075836145
18606060210
13075836247
18605911204
13075812112
13110897091
13075836149
18606999580
18650094591
18650094592
阅读(1584) | 评论(0) | 转发(0) |