0
2022.10.27 14:17:13.099 | INFO | Request finished in 23.3642ms 202 
2022.10.27 14:27:01.670 | INFO | Request finished in 4.7376ms 200 application/json; charset=utf-8
2022.10.20 00:12:02.122 | INFO | Request finished in 4.3007ms 200 application/json; charset=utf-8
2022.10.20 00:12:08.045 | DBUG | Starting HttpMessageHandler cleanup cycle with 4 items
2022.10.20 00:12:08.045 | DBUG | Ending HttpMessageHandler cleanup cycle after 0.0047ms - processed: 0 items - remaining: 4 items
2022.10.20 00:12:18.058 | DBUG | Starting HttpMessageHandler cleanup cycle with 4 items

in my log file I have rows like this. I need to count all rows with value "ms 2xx" (where xx is any number) for example 202,201,254,214,299 etc.

it should loo like this

Count Name
----- ----
   97 200
   278 202

I tried this

#Get-ChildItem "C:\Users\Scripts" | Select-String 'ms 200'
Select-String -Pattern "ms 200" -Path "C:\Users\Scripts\*.log" -Raw

#200ms
$filelist = Get-ChildItem -Path "C:\Users\Scripts" | Select-String 'ms 200'
Write-Host -NoNewline There is/are $filelist.Count line/s that contain 'ms 200' in all log files.

but his only works on values "ms 200". I need to count all "ms 2xx"

Gaara
  • 39
  • 5

0 Answers0