I need to get the occurrence of "failure" in a logfile. The thing is I need to get the occurrence of "failure" for each session block. What the log looks like:
---Session 1 check check failure failure check ----Session 2 check failure check check ----Session 3 failure failure
What I've got so far is this:
$rows = Get-Childitem -Path E:\shell\lot.log |
Select-String -Pattern failure
$i = 0
foreach ($row in $rows) {
$i++
}
echo $i
With that script I only get the total of the occurrences.
Sessionblocks? If so, why the use of-Recurse?