标题: 如何显示每行中指定字符!
[打印本页]
作者: wahagogogo
时间: 2008-3-21 15:18
标题: 如何显示每行中指定字符!
abc.txt内容如下:
aaa123
bbb234
ccc345
ddd456
编辑批处理得到如下内容:
123
234
345
456
作者: abcd
时间: 2008-3-21 15:41
Dim regEx, fso, f, str, fn
fn="abc.txt"
Set regEx = New RegExp
regEx.Pattern = "\D"
regEx.IgnoreCase = True
regEx.Global = True
set fso=createobject("scripting.filesystemobject")
set f=fso.opentextfile(fn,1)
do while f.atendofstream <> true
str=str®Ex.replace(f.readline,"")&vbCrLf
loop
f.close
set f=fso.opentextfile(fn,2)
f.write str
f.close
msgbox "修改完成"
set f=nothing
set fso=nothing
set regex=nothing
作者: HAT
时间: 2008-3-21 15:45
@echo off
setlocal enabledelayedexpansion
for /f %%a in (C:\abc.txt) do (
set row=%%a
echo !row:~-3!
)