Created
April 12, 2010 14:35
-
-
Save taka2/363621 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Set regex = New RegExp | |
| regex.Pattern = "\[[^\[\]]*\]" | |
| regex.Global = True | |
| Set dict = CreateObject("Scripting.Dictionary") | |
| Set fs = CreateObject("Scripting.FileSystemObject") | |
| Set ts = fs.OpenTextFile(WScript.Arguments(0)) | |
| While ts.AtEndOfStream = False | |
| lineData = ts.ReadLine() | |
| If Left(lineData, 2) = "*p" Then | |
| Set matches = regex.Execute(lineData) | |
| For Each match In matches | |
| If dict.Exists(match.Value) Then | |
| dict(match.Value) = dict(match.Value) + 1 | |
| Else | |
| dict.Add match.Value, 1 | |
| End If | |
| Next | |
| End If | |
| Wend | |
| ts.Close() | |
| For Each key In dict.Keys | |
| value = dict(key) | |
| If value > 1 Then | |
| WScript.Echo key & " = " & value | |
| End If | |
| Next | |
| msgbox "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment