求一个批处理命令 能批量删除记事本编码的
来源:百度知道 编辑:UC知道 时间:2024/06/30 14:20:32
没有 就有一个空格 然后还有就是总编码 能弄嘛
编号以正文有什么符号相隔吗,如、或:等,要不然你就贴一小段上来看看嘛~
能到能弄,这需要你的原文本结构,你随便贴一段上来嘛,就着要什么效果一起说出来不是多好?
如果是:数字+空格+行 的格式,那么下面的VBS应该可以实现:
Const ForReading = 1
Const ForWriting = 2
strFile = "c:\temp.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFile, ForReading)
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "([^\n\r])(\d{0,}) "
Do While not objFile.AtEndOfStream
colLines = objFile.ReadLine
strNewString = objRegEx.Replace(colLines,"")
colStrLines = colStrLines & strNewString & vbCrLf
Loop
objFile.Close
Set objFile = objFSO.CreateTextFile("c:\op.txt")
objFile.Write colStrLines
objFile.Close
Set objFSO = Nothing
源文件是c:\temp.txt,输出文件是op.txt。
for /f "tokens=1*" %%i in (a.txt) do (<