本帖最后由 77七 于 2023-2-24 00:43 编辑
- @echo off
- for /f "delims=" %%a in ('type "A.txt"') do (
- set "str=%%a"
- setlocal enabledelayedexpansion
- echo !str! | findstr "^7 ^8 ^48" 1>nul 2>nul && (
- >>B.txt echo !str!
- )
- endlocal
- )
- pause
复制代码
这样应该也行,正则表达式我不太会用- @echo off
- for /f "delims=" %%a in ('type "A.txt" ^| findstr "^7 ^8 ^48"') do (
- >>B.txt echo %%a
- )
- pause
复制代码
|