meiszp 当前离线
二级士官
评分人数
terse 当前离线
中将
@echo off&setlocal enabledelayedexpansion (for /f "delims=" %%f in ('dir /b /a-d *.txt') do ( set "exc=" for /f "usebackq tokens=*" %%i in ("%%f") do ( if defined exc ( for /f "tokens=2,3delims==" %%a in ("%%i") do ( if "%%b" neq "" ( for %%A in ("%%a" "%%b") do ( for /f %%c in (%%A) do set "exc=!exc! %%c" ) ) else ( echo !exc! set "exc=" ) ) ) if /i "%%~xni" == "excluding mass coefficients" (set exc=%%~nf) ) ))>out.txt 2>nul pause复制代码
TOP
77七 当前在线
中校
@echo off chcp 65001 >nul cd /d "%~dp0" (for /f "delims=" %%x in ('dir /b /a-d *.txt ^|find /v "out.txt"') do ( for /f "useback tokens=1-12" %%a in ("%%x") do ( if /i "%%a%%b%%c" equ "excludingmasscoefficients" ( set m=1 ) else if defined m ( if /i "%%a%%b%%c" equ "MAINST.K" ( set /p="%%~nx %%e %%k"<nul ) else if /i "%%a%%b%%c" equ "MAIND.C" ( echo= %%e %%k set m= ) ) ) ))>"out.txt" pause复制代码
aloha20200628 当前离线
上尉
@echo off &setlocal enabledelayedexpansion (for /f "delims=" %%F in ('dir /b/s/a-d *.txt') do ( set "v=%%~nF" for /f "tokens=1-4 delims==[" %%1 in ('findstr /ic:"MAIN ST. K =" /ic:"MAIN D. C =" "%%F"^|more +2') do ( set "v=!v! %%2 %%4" ) echo,!v: =! ))>out.txt.new复制代码
hfxiang 当前离线
gawk -v"OFS=\t" "/excluding mass coefficients/,/\*{60,}/{if(/MAIN/){A[++i]=$5;A[++i]=$11}if(/\*{60,}/)print substr(FILENAME,1,length(FILENAME)-4),A[1],A[2],A[3],A[4];next}{i=0}" *.txt>out.txt复制代码
@echo off &setlocal enabledelayedexpansion (for /f "delims=" %%F in ('dir /b/s/a-d *.txt') do ( set "v=%%~nF" for /f "tokens=1-4 delims==[" %%1 in ('findstr /ic:"MAIN ST. K =" /ic:"MAIN D. C =" "%%F"^|more +2') do ( set "v=!v! %%2 %%4" ) if "!v!" neq "%%~nF" echo,!v: =! ))>out.txt.new复制代码
@echo off &setlocal enabledelayedexpansion (for /f "delims=" %%F in ('dir /b/s/a-d *.txt') do ( (call :get5 "%%F" v5) &set "v=!v5!" for /f "tokens=1-4 delims==[" %%1 in ('findstr /ic:"MAIN ST. K =" /ic:"MAIN D. C =" "%%F"^|more +2') do ( set "v=!v! %%2 %%4" ) if "!v!" neq "!v5!" echo,!v: =! ))>out.txt.new exit/b :get5 for /f "usebackq skip=4 tokens=1 delims= " %%s in ("%~1") do (set "%~2=%%s"&exit/b) exit/b复制代码
@echo off chcp 65001 >nul cd /d "%~dp0" (for /f "delims=" %%x in ('dir /b /s /a-d *.txt') do ( if "%%~nxx" neq "out.txt" ( for /f "tokens=1* delims=[]" %%a in ('find /n /v "" ^<"%%x" ^|findstr /rb "\[5\] \[294\] \[296\]"') do ( if not defined str ( call :1 %%b ) else ( call :2 "%%b" ) ) call echo %%str%% set str= ) ))>out.txt pause & exit :1 set str=%* exit /b :2 for %%c in (%~1) do ( if "%%~xc" neq "" ( call set str=%%str%% %%~nxc ) ) exit /b复制代码