[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 批处理能否实现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   在同一个文件夹内      能批量替换么  


希望解答,先谢谢各位了

  1. @echo off
  2. set/p p=请输入前缀
  3. (for /f "tokens=1-2* delims='" %%a in (1.txt) do echo %%a'%p%%%b'%%c)>temp
  4. move temp 1.txt
  5. (for /f "tokens=1-4* delims='" %%a in (2.txt) do echo %%a'%%b'%%c'%p%%%d'%%e)>temp
  6. move temp 2.txt
复制代码
寒夜孤星:在没有说明的情况下,本人所有代码均运行在 XP SP3 下 (有问题请发贴,QQ临时会话已关闭)

TOP

返回列表