- <# :
- cls&echo off&mode con lines=3000
- rem 编码ANSI
- cd /d "%~dp0"
- powershell -NoProfile -ExecutionPolicy bypass "Invoke-Command -ScriptBlock ([ScriptBlock]::Create([IO.File]::ReadAllText('%~f0',[Text.Encoding]::GetEncoding('GB2312')))) -Args '%~f0'"
- pause
- exit
- #>
- $file1="1.txt";
- $file2="2.txt";
- $file3="3.txt";
-
- if(-not (test-path -liter $file1)){write-host ('"'+$file1+'" 未找到');exit;};
- $arr=New-Object -TypeName System.Collections.ArrayList;
- $enc=[Text.Encoding]::GetEncoding('GB2312');
- $text=[IO.File]::ReadAllLines($file1,$enc);
- for($i=0;$i -lt $text.count;$i++){
- $m1=[regex]::match($text[$i],'(Proofs -?\d+(?:\.\d+)? / -?\d+(?:\.\d+)?) ?, ?(-?\d+(?:\.\d+)?)');
- if($m1.success){
- $n=$i-4;
- if($n -ge 0){
- $m2=[regex]::match($text[$n],'Testing plot ?(.+)(?=\x1b)');
- if($m2.success){
- $brr=($m1.groups[1].value,$m1.groups[2].value,$m2.groups[1].value);
- [void]$arr.add($brr);
- }
- }
- }
- }
-
- $result=New-Object -TypeName System.Collections.ArrayList;
- for($i=0;$i -lt $arr.count;$i++){
- $line=$arr[$i][2]+'-->'+$arr[$i][0]+','+$arr[$i][1];
- [void]$result.add($line);
- }
- [IO.File]::WriteAllLines($file2,$result,$enc);
-
- $result=New-Object -TypeName System.Collections.ArrayList;
- for($i=0;$i -lt $arr.count;$i++){
- if(1*($arr[$i][1]) -lt 1){
- $line=$arr[$i][2]+'-->'+$arr[$i][0]+','+$arr[$i][1];
- [void]$result.add($line);
- }
- }
- [IO.File]::WriteAllLines($file3,$result,$enc);
-
- exit;
复制代码
|