You can use this LINQ query to real the lines of the file and extract the informations:
var allOccurrences = File.ReadLines("Path")
.Select(l => new { HappenIndex = l.IndexOf(" HAPPENS "), Line = l })
.Where(LineInfo => LineInfo.HappenIndex >= 0)
.Select(LineInfo =>
{
var retVal = new { LineInfo, What = LineInfo.Line.Substring(0, LineInfo.HappenIndex).Trim(), Occurences = (int?)null };
int timesIndex = LineInfo.Line.IndexOf(" TIMES", LineInfo.HappenIndex + " HAPPENS ".Length);
if(timesIndex >= 0)
{
int behindHappen = LineInfo.HappenIndex + " HAPPENS ".Length;
string times = LineInfo.Line.Substring(behindHappen, timesIndex - behindHappen).Trim();
int occurences;
if(int.TryParse(times, out occurences))
retVal = new { LineInfo, retVal.What, Occurences = (int?)occurences };
}
return retVal;
})
.Where(x => x.Occurences.HasValue)
.ToList();
foreach (var occ in allOccurrences)
{
Console.WriteLine("Line contains '{0}' {1} times", occ.What, occ.Occurences);
}