@echo off setLocal enableDelayedExpansion REM using imported data from the judges' evaluation sheet REM *.res files are formatted like this: REM "//RATING-CATEGORY_CONTESTANT REM 72-Flow_Striker REM 75-SFX_Striker REM 79-Theme_Striker REM 62-CC_Striker REM 75-Creativity_Striker REM 68-Flow_Kibi REM 1-SFX_Kibi REM 71-Theme_Kibi REM 66-CC_Kibi REM 75-Creativity_Kibi REM 50-Flow_NerwinLeevayy REM 53-SFX_NerwinLeevayy REM 52-Theme_NerwinLeevayy REM 52-CC_NerwinLeevayy REM 50-Creativity_NerwinLeevayy" set /a "count=0" for %%a in ("*.res") do ( set /a "count+=1" for /f %%b in (%%a) do ( for /f "tokens=1,2 delims=-" %%c in ("%%b") do ( set /a "_%%d=!_%%d!+%%c" ) ) ) REM SFX counts half for /f "tokens=1,2 delims==" %%a in ('set _SFX') do ( set /a "%%a=%%b/2" ) REM divide by amount of judges REM for /f "tokens=1,2 delims==" %%a in ('set _') do ( REM set /a "%%a=%%b/count" REM ) :export REM separate topics for %%a in (Flow, CC, SFX, Theme, Creativity) do ( if exist %%a.txt del /s /q %%a.txt for /f "tokens=1,2 delims==" %%b in ('set _%%a') do ( echo %%c: %%b >> %%a.srt ) if exist %%a_sorted.txt del /s /q %%a_sorted.txt sort /r %%a.srt >> %%a_sorted.txt del /s /q %%a.srt ren %%a_sorted.txt %%a.txt ) :exportavg REM average on all topics set /a "count=0" for %%a in (Flow, CC, SFX, Theme, Creativity) do ( set /a "count+=1" for /f "tokens=1,2,3 delims==_" %%b in ('set _%%a_') do ( set /a "avg_%%c=!avg_%%c!+%%d" ) ) for /f "tokens=1,2 delims==" %%a in ('set avg_') do ( set /a "fix=!%%a!/5" REM echo %%a !fix! echo !fix!: %%a >> avg.srt ) if exist avg_sorted.txt del /s /q avg_sorted.txt sort /r avg.srt >> avg_sorted.txt del /s /q avg.srt pause