none
Powershell Search using arrays RRS feed

  • Question

  • I have a need to search a log file for a certain error and if that error exists, write that line to a text file. I then email the lines in the text file. I was able to do this using select-string without any problem. But, I also need to add functionality to ignore certain strings.

    For example, the string I am searching for is "ORA-". But, lets say for argument sake, I also want to ignore errors like "ORA-01", ORA-02, and so on. Over time, since I will need to easily add errors that can be ignored, what I am trying to do is have an array of errors that can be ignored and not written to the text file. So, if the log file has "ORA-01", I will not be emailed since it is an error that can be ignored.

    This is easy in UNIX, but I have not been able to get it working in Powershell What is the best/easiest way to handle this in Powershell?

    • Moved by Bill_Stewart Monday, September 11, 2017 3:43 PM This is not "scripts on demand"
    Sunday, July 16, 2017 1:06 PM

All replies