vendredi 27 juillet 2018

Powershell - Print the line if the 2 patterns are found

I have the following lines:

<option title="ORACLEDB" selected="selected" value="1111">ORACLEDB</option>
<option value=""  selected="selected"></option>
<option title="TRINITY" value="3162">TRINITY</option>

And I would need to print it ONLY if "option title" and "selected" are found.

When I use:

select-string -pattern "option title","selected" -Path "C:\Users\am281h\Desktop\page.htm" -AllMatches

Then it prints me ALL the lines matching either "option title " or "selected", when the result should be only that first line.

Any suggestions please?

Aucun commentaire:

Enregistrer un commentaire