Link to home
Start Free TrialLog in
Avatar of rutgermons
rutgermons

asked on

powershell filter/match help

folks

my powershell script searches for a specific value  i.e. ERROR in another log file

Get-Content TEST.log -wait | where { $_ -match “Error” } |out-file logger.txt -append

how can i get it to search multiple values? i.e  ERROR and INCIDENT

keen for your thoughts
ASKER CERTIFIED SOLUTION
Avatar of Peter Hutchison
Peter Hutchison
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's usually better to use the regex features of -match. But in the case of simple string pattern matches only, I would use the Select-String cmdlet:
Get-Content TEST.log -wait | Select-String -SimpleMatch “Error”, "Incident" |out-file logger.txt -append

Open in new window