I have found this link
, which has helped me form the majority of my code. However, in these examples, the output is being piped to a file. I could turn around and read the contents of the file, but I would rather get the results into a variable (btw, there will only be one line that matches, if any). If I use:
$s = Select-String -Path $ERROR_LOG -Pattern $regex
then $s contains a string in the format of:
- full contents of entire line
error.log:49:2015/07/07 12:15:30 - blah blah blah blah: Incorrect syntax near '.84603e-005'.
However, I want only the data that matched the regex ("Incorrect syntax near '.84603e-005'.") to be returned.
Any easy way to accomplish that?