本帖最后由 Nsqs 于 2017-1-22 04:45 编辑
方法1 | | | 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 withCOPY |
方法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>nulCOPY |
|