I\'m on windows dos prompt. I have log file which contains log like:
Timestamp: Order received for Item No. 26551
Timestamp: Exception: OutOfRangeException
T
If you are on Vista or Windows 7 (or if you install it manually on XP), you can use PowerShell for this:
$resultlist = new-object System.Collections.Specialized.StringCollection
$regex = [regex] '(?m)^.*Exception.*\r\n.*Item No\. (\d+)'
$match = $regex.Match($subject)
while ($match.Success) {
$resultlist.Add($match.Groups[1].Value) | out-null
$match = $match.NextMatch()
}
$resultlist will then contain a list of all item numbers that follow a line with Exception in it.