本帖最后由 w1983912 于 2011-4-18 02:11 编辑
最新消息 15楼朋友的代码 已经差不多可以了 只有一点没实现 希望大家继续帮忙 小小的修改一下 谢谢
GBK 文本 替换并按规定生成数字
1.txt:
INSERT INTO `dede_x` VALUES('217','11','113','1','真爱你的云','45','红苹果连续七年','1012112345','\n红苹果连续七年','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('218','11','113','1','乡巴佬','27','线上线下共赢','1351511238','\n线上线下共赢市将更更加畅通','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('219','2','114','1','a贼之手','35','一次性快餐盒,木盒','1202157603','\n产品外观单价0.14 .6双 纸汤\n\n','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('220','10','115','1','你的','45',KK12果连续七年','1102107622','\nkkkk红苹果连续','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('221','10','115','1','巴佬','27','aaa上线下共赢','1402127624','\n线上55555线下共加畅通','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('222','10','115','1','贼手','35','一次111餐盒,木盒','1002357670','\n产1233333品外观单6双 纸汤\n\n','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('223','10','116','1','11手','3','次1餐盒木盒','1802357620','\n观汤\n\n','','0','0','0','0','0','0','0','0','0','0','0');
只有 特征: 第一个 数字 是序号 VALUES('217' 每加一行 数字+1
第2个数字 是文章的 栏目ID
第3个数字 是变化的 也是递增 文章的评论ID 所以 一文章多个评论就会有相同的
第4个数字 是变化的 也是递增 文章某条评论的发表时间 都是10位数字 需要改变的就是这个
比如设置好 第一条(根据第3个数字从1或217开始[最好可以设置能从第几条开始])
第3个数字 相同 那么 第一行 10位数固定增加50 从第2行开始能随机增加100-500就更好拉
从第113文章开始 10位数从 1000010000开始 115 有3行 第一行 固定50
第2行随机获得66 在115 第一行的数字上+66 第3行随机获得394 在115 第2行的数字上+398
115第4行由于是116 所以在115的第一行继续开始+50
如变为:
INSERT INTO `dede_x` VALUES('217','11','113','1','真爱你的云','45','红苹果连续七年','1000010050','\n红苹果连续七年','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('218','11','113','1','乡巴佬','27','线上线下共赢','1000010100','\n线上线下共赢市将更更加畅通','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('219','25','114','1','a贼之手','35','一次性快餐盒,木盒','1000010150','\n产品外观单价0.14 .6双 纸汤\n\n','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('220','10','115','1','你的','45',KK12果连续七年','1000010200','\nkkkk红苹果连续','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('221','10','115','1','巴佬','27','aaa上线下共赢','1000010266','\n线上55555线下共加畅通','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('222','10','115','1','贼手','35','一次111餐盒,木盒','1000010664','\n产1233333品外观单6双 纸汤\n\n','','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x` VALUES('223','10','116','1','11手','3','次1餐盒木盒','1000010250','\n观汤\n\n','','0','0','0','0','0','0','0','0','0','0','0');
2.txt:--------------------已经有朋友帮忙解决了----------------------------------------------------
INSERT INTO `dede_x2` VALUES('605','11','0','0','0','0','0','爱的诺','34','萍乡频道介入','1302167624','1302168087','大佐','169','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x2` VALUES('606','11','0','0','0','0','0','找不','41','切实解决群众','1302166124','1302167453','叫小乖','81','3','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x2` VALUES('607','11','0','0','0','0','0','老虎','24','市政府终于下决心','1302161624','1302164636','龙天下','145','12','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x2` VALUES('608','11','0','0','0','0','0','仙人','20','萍乡市个人年收入','1302166624','1302167280','幽风月','24','2','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0');
2个 10位数 从1000010000
每行的第1个10位数 在上一行数字基础上+50 第2个10位数在本行 第1个10位数基础上随机加5000-10000
这4行 获得的随机数字 比如是 依次 5619 6922 8011 7092
变如下:
INSERT INTO `dede_x2` VALUES('605','11','0','0','0','0','0','爱的诺','34','萍乡频道介入','1000010050','1000015669','大佐','169','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x2` VALUES('606','11','0','0','0','0','0','找不','41','切实解决群众','1000010100','1000017022','叫小乖','81','3','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x2` VALUES('607','11','0','0','0','0','0','老虎','24','市政府终于下决心','1000010150','1000018161','龙天下','145','12','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0');
INSERT INTO `dede_x2` VALUES('608','11','0','0','0','0','0','仙人','20','萍乡市个人年收入','1000010200','1000017292','幽风月','24','2','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0');
-----------------------------------------------------------------------------------------------
发个参考代码 只能按行把10位数生成 之前是我没考虑这个因素....
http://bathome.net/thread-11689-1-1.html
随风 的代码- @echo off
- set /a n=1295097000-3030
- for /f "delims=" %%i in (a.txt) do (
- set "str=%%i"
- set /a n+=3030
- setlocal enabledelayedexpansion
- set aus=!str:'= !
- for %%j in (!aus!) do (
- set var=%%ja&set num=%%j
- for /l %%L in (0 1 9) do (
- set var=!var:%%L=!
- set num=!num:%%L= %%L !
- )
- if "!var!"=="a" (
- set i=0
- for %%j in (!num!) do set /a i+=1
- if !i! equ 10 (
- set num=!num: =!
- for %%j in (!num!) do (
- for %%k in (!n!) do set str=!str:%%j=%%k!
- )
- )
- )
- )
- echo !str!
- endlocal
- )
- pause
复制代码 望哪位朋友帮我变通一下这个文本的解决办法 谢谢 |