本帖最后由 Nsqs 于 2017-1-22 04:45 编辑
方法1- ' 2>nul &cls&(type "1.txt"|cscript -nologo -e:"vbs" "%~0")>new.txt&exit
- set ws=wsh.stdin:set regexp=new regexp
- with regexp
- do
- .global=-1:.pattern="^.+\|\d*$"
- read=ws.readline
- if not .test(read) then wsh.echo read
- loop until ws.atendofstream
- end with
复制代码 方法2- @echo off&setlocal enabledelayedexpansion
- (for /f "tokens=1-2 delims=|" %%1 in (1.txt)do (
- set /a n=%%2
- if !n! equ 0 echo %%1^|%%2
- ))>new.txt 2>nul
复制代码
|