Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Search large array created via import-csv

$
0
0

Hello,

I've got a problem with the search I am performing in my Script.

There are two  large arrays imported from CSV-files, they hold DNS data like

name,type,data
hostname,CNAME,alias123.contoso.com

I'm now searching to see if my $dataONE exists in $inputTWO, and get the values of the array.

-match does not work as it is ambigious and finds lines with additional letters behind my $dataONE, like "alias123ETC" aswell.

So what i did is 

		if ($inputTWO.name -eq $dataONE)

However, that only gives me the the inputTWO.name back, but i need to work with the inputTWO.type and data of that line aswell.

I then tried 

(($inputTWO -match $dataONE) | where {$_.name -eq $dataONE}) 

But that takes 27-28 seconds to run, that for my 4000 Records in inputONE, will take me over 30 hours to run :S Let alone the rest of the script.

Is there a better way to search for the line where $inputTWO.name matched $dataONE, without ambigious results, and enabling me to directly work with $inputTWO.type etc.?

Btw, my $inputTWO is approv 140k records big.

Thanks in advance :)


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>