Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Find keyword in text file from an array

$
0
0

Hi,

I have an array of collection of keyword:

$KeyWord = @("Fail","Exception","Terminated","Error")

I want to check in a textfile sample.txt, if any or all keywords from the array $KeyWord exist. If any of the keyword exist in the textfile, a boolean variable $ExceptionOccurred will return $true.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>