Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell - Pipe values from text file into select-string query

$
0
0

Hi,

I have a list of values from a command below:

$a = get-content c:\test.txt | Select-String 'test'

which outputs;

test1
test2
test3

I'd like to then perform another select-string query using these values on a different file, similar to

get-content c:\new.txt | select-string -pattern $a  | add-content c:\report.txt

Can someone help how I can read in the contents of $a (test1, test2 and test3) a line at a time?

Thanks


Viewing all articles
Browse latest Browse all 15028

Trending Articles