I have this C:\test.csv file:-
and i am importing this file and read the data as follow:-
$SourceID = @()
$DestinationID = @()
Import-Csv C:\test.csv |`
ForEach-Object {
$SourceID += $_.SourceID
$DestinationID += $_."DestinationID"
}
but how i can query the .CSV file based on the source ID? for example to get the DestinationID for the SourceID = 1?
Thanks

ForEach-ObjecttoWhere-Object { $_.SourceId -eq 1 }should be it$csv | Where-Object ...Import-Csv test.csv | foreach-object { $hash = @{} } { $hash[$_.sourceid] = $_.destinationid }