November 2018
Intermediate to advanced
566 pages
17h 15m
English
We will build on the Accessing and manipulating array items recipe. Here is the flow:
The following script would accomplish this:.
$Names = Get-Content ./ch09/02-names.txt
$NewNames = @()
foreach ($Name in $Names) {
$Name = $Name -split ' '
$NewName = $Name[1], $Name[0] -join ', '
$NewNames += $NewName
}
if ($NewNames -contains 'Torres, Leon') {
Write-Host "Found Leon Torres in the list!"
}
Read now
Unlock full access