-
Notifications
You must be signed in to change notification settings - Fork 318
/
Copy pathuniq.vbs
38 lines (31 loc) · 1.2 KB
/
uniq.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
'-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
Dim curRow, prevRow, rowCount, lineSize
prevRow = ""
rowCount= 0
lineSize = 900
Set re1 = New RegExp
re1.Pattern = "\+[0-9]*"
re1.Global = True
Set re2 = New RegExp
re2.Pattern = ".*sspuser\(\)"
re2.Global = False
re2.IgnoreCase = True
Set re3 = New RegExp
re3.Pattern = ".*(" & WScript.Arguments.Item(0) & "\(\)<-)"
're3.Pattern = ".*<-(.*\(\)<-" & WScript.Arguments.Item(0) & "\(\)<-)"
re3.Global = False
re3.IgnoreCase = True
With WScript
Do
curRow = re3.replace(re2.replace(re1.Replace(WScript.StdIn.ReadLine, ""),""), "$1")
If rowCount = 0 Then prevRow = curRow
rowCount = rowCount + 1
If curRow <> prevRow Then
WScript.StdOut.WriteLine Space(6-Len(rowCount - 1)) & rowCount - 1 & " " & Space(lineSize-Len(prevRow)) & prevRow
rowCount = 1
End If
prevRow = curRow
Loop Until WScript.StdIn.AtEndOfStream
WScript.StdOut.WriteLine Space(6-Len(rowCount)) & rowCount & " " & Space(lineSize-Len(prevRow)) & prevRow
End With