I have tried applications applications of Select-String or -match etc to get what I need. It is just not happening. Using the string as examples.. I am searching a text file so I can then grab to the ed of the line for each match so I can save the data after the string.
& data df put king/man/ConnString
& data df put king/man/ConnStringLog
& data df put king/man/ConnStringSession
For example, if I look for the string "& data df put king/man/ConnString" using -SimpleMatch I get all three lines returned like the following:
& data df put king/man/ConnString "Connection data 1"
& data df put king/man/ConnStringLog "Connection Log data"
& data df put king/man/ConnStringSession "Conn String data"
I want an exact match so I can then grab save the data after "& data df put king/man/ConnString" and I am left with "Connection data 1" as well as for each other line I search for like
& data df put king/man/ConnStringLog
& data df put king/man/ConnStringSession
Any help would be appreciated.
You can search for those different strings like below:
Or use regex
-replace:P.S. If you also need the search to be case-sensitive, then change
-matchinto-cmatchin the first code and-replaceinto-creplacefor the second codeAs per your comment the wanted data may or may not be quoted as in your example lines, then change the regex creation in the first code block into
Basically remove the quotes in the regex
As alternative, here's another approach using
switch(line-by-line):