I have this ps code
PS > Select-String -path .\build-count-warn.txt -pattern "[1-9]?[0-9]+ warn"
warn.txt:1: 0 Warning(s)
warn.txt:2: 1 Warning(s)
warn.txt:3: 2 Warning(s)
..
So how to extend the ps script and report the sum of 0+1+2=3
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Capture the numeric value in the regex like so:
FYI I tested this on PowerShell V3 which supports member enumeration. On V2, you may need to do this: