还可以试试哈希表的方式- $f=gc a.csv
- $a=@{}
- $rex={[int]($_ -replace '^(\d+),.*','$1')}
- $f[1..$f.count]|%{$a+=@{$(&$rex)=$_}}
- (gc b.csv)[1..$f.count]|%{if($a.contains($(&$rex))){$a[$(&$rex)]=$a[$(&$rex)]+',已完成'}}
- sc c.csv ($f[0],$(do{$a[++$bcc]}while($a[$bcc] -ne $null)))
复制代码
|