Local $Str = _
'FSZHB1 04 2012-11-22 1348 S000008953 BC14D02100 0 3992 0 0 0 3992' & @CRLF & _
'FSZHB1 04 2012-11-22 1552 S000008954 BC14D01599 0 128 0 0 0 128' & @CRLF & _
'FSZHB1 04 2012-11-22 1552 S000008954 BC14D99999 0 -128 0 0 0 -128' & @CRLF & _
'FSZHB1 04 2012-11-22 1554 S000008955 BC14D99999 0 -1280 0 0 0 -1280' & @CRLF & _
'FSZHB1 04 2012-11-22 1554 S000008955 BC14D02097 0 1280 0 0 0 1280' & @CRLF & _
'FSZHB1 04 2012-11-22 1907 S000008956 BC14D02087 0 3690 0 0 0 3690' & @CRLF & _
'FSZHB1 04 2012-11-22 1907 S000008956 BC14D01796 0 158 0 0 0 158' & @CRLF & _
'FSZHB1 04 2012-11-22 1907 S000008956 BC14D01579 0 248 0 0 0 248' & @CRLF & _
'FSZHB1 04 2012-11-22 1907 S000008956 BC14D99999 0 -4096 0 0 0 -.4096' & @CRLF & _
'FSZHB1 04 2012-11-22 1907 S000008956 BC14D99996 0 10000 0 0 0 10000' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D99996 0 -10000 0 0 0 -10000' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D99996 0 10000 0 0 0 10000' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D01579 0 248 0 0 0 248' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D99998 0 -4581 0 0 0 -4581' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D01796 0 158 0 0 0 158' & @CRLF & _
'FSZHB1 04 2012-11-22 2120 S000008957 BC14D01908 0 14175 0 0 0 14175'
Local $sOut = $Str, $ts = TimerInIt()
Local $aDuan = StringRegExp($str, '(?mi)^.+?\h+\d{4}\h+(s\w+)\h+[\S\s]+\1\V+', 4)
If Not @Error Then
Local $aTmp, $aTmp1, $Line, $val, $val1, $i, $ii, $iii, $aSR
For $i = 0 To UBound($aDuan) - 1
$aTmp = $aDuan[$i]
$aSR = StringRegExp($aTmp[0], '(?mi)^.+?\h+\d{4}\h+s\w+\h+\w+\h+\w+\h+(\S+)\V+', 4)
If @Error Then ContinueLoop
For $ii = 0 To UBound($aSR) - 1
$aTmp1 = $aSR[$ii]
$Line = $aTmp1[0]
$val = $aTmp1[1]
For $iii = $ii + 1 To UBound($aSR) - 1
$aTmp1 = $aSR[$iii]
$val1 = $aTmp1[1]
If $val + $val1 = 0 Then
$sOut = StringReplace($sOut, $Line, '')
$sOut = StringReplace($sOut, $aTmp1[0], '')
$ii = $iii
ContinueLoop 2
EndIf
Next
Next
Next
MsgBox(0, Round(TimerDiff($ts), 2) & ' ms', $Str & @LF & @LF & _
' --------- 处理结果如下,未删除空行是为了对比明示 --------- ' & @LF & @LF & $sOut)
EndIf
|