- $a=New-Object Collections.Specialized.OrderedDictionary
- $h='/abc'
- if($s -match "(?s)(?<=$h\s+).+?(?=\s+#)"){$c=$matches[0]}
- $c -split '\n'|%{
- if($_ -match '^(\S+)\s+:((\D+)(\d+))\s*;;\S*\s*([^\r\n]+)'){
- $d=$matches
- if($s -match "(?s)(?<=\r\n#$($d[2]) m ;;.*?\r\n).+?(?=\s*#bub Bub\d+ m ;;|\s*$)"){
- $a[$d[1]]+=,@($d[3],$d[5],$matches[0],$d[4])
- }else{$a[$d[1]]+=,@($d[3],$d[5],'我是新建的',$d[4])}
- }
- }
- $a.Keys|%{
- $e=$_
- $a.$e|sort{[int]$_[3]}|%{
- $j++
- $f+=@("{0} :{1}{2} ;;{3} {4}" -f $e,$_[0],++$i,$j,$_[1])
- $g+=@("#bub Bub$i m ;;$e`t$($_[1])`r`n$($_[2])")
- }
- $j=0
- }
- "$h`r`n$($f -join "`r`n")`r`n`r`n$($g -join "`r`n`r`n")"
复制代码
|