用awk处理余数在分表中的具体方法

jackxiang 2010-10-28 09:38 | |
对用户号码分为1000个表,0--->999,咋个通过awk去管理里面的一些号码呢,那就是用如下的方法,构造SQL语句:
881607843494
8881575730024
888844538713
8881547203329
8881551222564
8881620264123
8881098097115
8881622129944
8881311344768
8881609513205
8881643662199
8881652446787
8881664232709
8881623970620
8881642895112
8881436794690
8881359061975


cat QQ.txt |awk '{print "select * from Tbl_User_"$1%1000 "where FQQ='\''" $1 "'\'';"}'

执行了后显示如下结果:
select * from Tbl_User_494where FQQ='1607843494';
select * from Tbl_User_24where FQQ='1575730024';
select * from Tbl_User_713where FQQ='844538713';
select * from Tbl_User_329where FQQ='1547203329';
select * from Tbl_User_564where FQQ='1551222564';
select * from Tbl_User_123where FQQ='1620264123';
select * from Tbl_User_115where FQQ='1098097115';
select * from Tbl_User_944where FQQ='1622129944';
select * from Tbl_User_768where FQQ='1311344768';
select * from Tbl_User_205where FQQ='1609513205';
select * from Tbl_User_199where FQQ='1643662199';
select * from Tbl_User_787where FQQ='1652446787';
select * from Tbl_User_709where FQQ='1664232709';
select * from Tbl_User_620where FQQ='1623970620';
select * from Tbl_User_112where FQQ='1642895112';
select * from Tbl_User_690where FQQ='1436794690';
select * from Tbl_User_975where FQQ='1359061975';

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/3701/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!

评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]