How can i search and return unique user counts across various searches using C sharp?
<p>I have a log file in following format  and i want to find out unique user counts for "WX GSA Search".</p>

<pre><code> WX GSA Search = Server: yukon.corp.adobe.com User: karansha appGUID
 WX GSA Search = Server: yukon.corp.adobe.com User: gulanand appGUID
 WX GSA Search = Server: yukon.corp.adobe.com User: ravsingh appGUID
 WX Search = Server:yukon.corp.adobe.com User:adoda appGUID
 WX Search = Server:yukon.corp.adobe.com User:adoda appGUID
 WX ADVSearch = Server:yukon.corp.adobe.com User:adoda appGUID
 WX ADVSearch = Server:yukon.corp.adobe.com User:adoda appGUID
</code></pre>

<p>Code I have tried is :</p>

<pre><code>string searchKeyword = "WX GSA Search";
        string fileName = "C:\\Users\\karansha\\Desktop\\search tab.txt";
        string[] textLines = File.ReadAllLines(fileName);
        List&lt;string&gt; results = new List&lt;string&gt;();
        foreach (string line in textLines)
        {
            if (line.Contains(searchKeyword))
            {
                results.Add(line);
            }
        }
        Regex regex = new Regex(@"User:\s*(?&lt;username&gt;.*?)\s+appGUID");
        MatchCollection matches = regex.Matches(fileName);
        foreach (Match match in matches)
        {
            var user = match.Groups["username"].Value;
            if (!results.Contains(user)) results.Add(user);
        }
        int numberOfUsers = results.Count;
        Console.WriteLine(numberOfUsers);
        // keep screen from going away
        // when run from VS.NET
        Console.ReadLine();
</code></pre>
