I have a text file log that looks like this
2 total number of add errors
I have a script that is
get-content "c:\logfile.txt | select-string "total number of add errors"
I cant remember how to get it to just show the number.
Any suggestions?
You can use -match with a regular expression to parse the string:
This will will pull out the number up to five digits. Change the second number in
{1,5}
if there will be larger numbers.