返回列表 发帖
@echo off
setlocal EnableDelayedExpansion
(for /f "delims=" %%i in (1.txt) do (
    set "str=%%i"
    echo !str! | findstr "^....-..-...*ERROR" > nul
    if !errorlevel! equ 0 (
        echo %%i
    ) else (
        echo !str! | findstr "^....-..-.." > nul
        if !errorlevel! neq 0 (
            echo %%i
        )
    )
))>2.txtCOPY

TOP

回复 8# poi
@echo off
setlocal EnableDelayedExpansion
(for /f "delims=" %%i in (1.txt) do (
    set "str=%%i"
    echo "!str!" | findstr "^.....-..-...*ERROR" > nul
    if !errorlevel! equ 0 (
        echo !str!
    ) else (
        echo "!str!" | findstr "^.....-..-.." > nul
        if !errorlevel! neq 0 (
            echo !str!
        )
    )
))>2.txtCOPY

TOP

你好,刚那个bat还有点小问题,能看下嘛?

不用发短消息给我,直接在我的回帖下面点击“回复”就行了。

TOP

回复 11# poi


用gawk.exe试试
gawk "{if($0~/....-..-...*ERROR/)print;else if($0!~/....-..-../)print}" 1.txt > 2.txtCOPY

TOP

回复 15# poi


    请看13楼

TOP

返回列表