标题: [文本处理] 批处理能否实现2个txt内同步替换呢? [打印本页]
作者: w1983912 时间: 2011-1-1 12:20 标题: 批处理能否实现2个txt内同步替换呢?
首先 元旦快乐 感谢大家回答我的问题 新的一年我会继续有需求再来麻烦各位
31644---31649 的数据
1.txt 表的内容
INSERT INTO `dedea2_ask` VALUES('31644','3','科学','4','学习','1','0','读书','0','5','1293810660','1303504417','0','0','0','0','0','1','127.0.0.1','','');
INSERT INTO `dedea2_ask` VALUES('31645','1','家','55','减','1','0','每天','0','0','1289938735','1293176100','1293176100','65997','1','0','0','4','127.0.0.1','','');
INSERT INTO `dedea2_ask` VALUES('31646','17','码','18','机','1','0','手机','0','0','1293810840','1297267108','0','0','0','0','0','0','127.0.0.1','','');
INSERT INTO `dedea2_ask` VALUES('31647','1','居','110','购物','1','0','天然水晶的报价','0','10','1293805320','1299374259','0','0','0','0','0','2','127.0.0.1','一个珠串需要','');
INSERT INTO `dedea2_ask` VALUES('31648','0','','0','','0','0','','0','0','12931141','130246','0','0','0','0','0','0','127.0.0.1','','');
INSERT INTO `dedea2_ask` VALUES('31649','87','运动','88','篮球','1','0','全篮球联赛安装','0','50','1293809520','1300591075','0','0','0','0','0','0','127.0.0.1','请高','');
2.txt 表的内容
INSERT INTO `dedea2_askanswer` VALUES('65996','31644','1','3','4','1','pdlot','0','0','0','127.0.0.1','1293810840','','<p>只能说不一定</p>','1');
INSERT INTO `dedea2_askanswer` VALUES('65997','31645','1','1','55','1','srost','0','0','0','127.0.0.1','1293176040','','<p>1、最简单的瘦腿;</p>','1');
INSERT INTO `dedea2_askanswer` VALUES('65998','31645','1','1','55','1','ordlst','0','0','0','127.0.0.1','1293176040','','<p> </p><p><strong>我一直用。<br>【.<br></strong></p>','1');
INSERT INTO `dedea2_askanswer` VALUES('65999','31645','1','1','55','1','past','0','0','0','127.0.0.1','1293176040','','<strong><p><br>是','1');
INSERT INTO `dedea2_askanswer` VALUES('66000','31645','1','1','55','1','sswost','0','0','0','127.0.0.1','1293176040','','如果节食','1');
INSERT INTO `dedea2_askanswer` VALUES('66001','31646','1','1','110','1','pdlot','0','0','0','127.0.0.1','1293805740','','<p这个网站上比上全有了</p>','1');
INSERT INTO `dedea2_askanswer` VALUES('66002','31647','1','1','110','1','porst','0','0','0','127.0.0.1','1293805920','','<p>看看自己重要己喜欢。</p>','1');
INSERT INTO `dedea2_askanswer` VALUES('66003','31648','1','3','4','1','psost','0','0','0','127.0.0.1','1293810840','','能说不一定</p>','1');
INSERT INTO `dedea2_askanswer` VALUES('66004','31649','1','3','4','1','asost','0','0','0','127.0.0.1','1293810840','','<p>不一定</p>','1');
31644---31649 是文章的id 能不能 实现替换呢? 在文章ID前全部加上任意指定的数字呢 ? 比如2,33,105, 2309
问题是2个表都要一样的实现 所有的都是2M 一个的txt 在同一个文件夹内 能批量替换么
希望解答,先谢谢各位了
作者: hanyeguxing 时间: 2011-1-1 16:08
- @echo off
- set/p p=请输入前缀
- (for /f "tokens=1-2* delims='" %%a in (1.txt) do echo %%a'%p%%%b'%%c)>temp
- move temp 1.txt
- (for /f "tokens=1-4* delims='" %%a in (2.txt) do echo %%a'%%b'%%c'%p%%%d'%%e)>temp
- move temp 2.txt
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |