高分:文本问题如何用.bat 或VB批量替换

来源:百度知道 编辑:UC知道 时间:2024/05/14 18:09:10
100分求.bat 或VB批量替换
例如
111 恭喜发财
111 恭喜发财
111 恭喜发财
111 恭喜发财
111 恭喜发财
111 恭喜发财

批量改成
112 恭喜发财
113 恭喜发财
114 恭喜发财
115 恭喜发财
116 恭喜发财
117.。。。
120.。。
999.。。

要实现数字逐渐增加的
谢谢
不是生成文件哦
是要批量递进数值
INSERT INTO phpcms_product VALUES('501'
INSERT INTO phpcms_product VALUES('501'
INSERT INTO phpcms_product VALUES('501'
INSERT INTO phpcms_product VALUES('501'
INSERT INTO phpcms_product VALUES('501'
INSERT INTO phpcms_product VALUES('501'
INSERT INTO phpcms_product VALUES('501'

改成
INSERT INTO phpcms_product VALUES('501'
INSERT INTO phpcms_product VALUES('502'
INSERT INTO phpcms_product VALUES('503'
INSERT INTO phpcms_product VALUES('504'
INSERT INTO phpcms_product VALUES('505'
INSERT INTO phpcms_product VALUES('506'

更新:

@echo off & setlocal Enabledelayedexpansion

set n=500

for /f "delims=" %%i in (a.txt) do (
set /a n+=1
set "var=%%i"
set "%%i=!n!"
call set var=%%var:501=!n!%%
echo !var!
)>>op.txt
start op.txt
pause

Private Sub Form_Load()
thename = "a.txt" '文件名(包括扩展名)
n = 111 '原始数
thepath = App.Path 'App.Path为程序所在的目录
If Dir(thepath & "\" & thename) = "" Then
MsgBox "该文件不存在"
Else
Open thepath & "\" & thename For Input As #1
Open thepath & "\" & thename & "(修改后)" For Output As #2
lenth = Len(n)
Do While Not EOF(1)
n = n + 1
Line Input #1, aaa
Print #2, n & Right(aaa, Len(aaa) - lenth)
Loop
Close #1
Close #2
End If
End
End Sub

假设你原文件是a.txt,运行以下批处理可达到你要求:
@echo off&set