Help with output from import-csv and -join / replace
i'm having trouble in getting correct output following script.
foreach ($line in import-csv c:\computers.csv) { $computer = $line.computer $a = $line.info $b = -join "$line.computer".replace("-","")[0,1,-2,-1] $computer $a $b }
the .csv file has computer name of "abc-testcomp01" in column "a" , "someinfo" in column "b"
$computer returns "abc-testcomp" correctly
$a returns "someinfo"
$b returns "@{er"
however @ console
-join "abc-testcomp".replace("-","")[0,1,-2,-1] returns correctly with "abmp"
how can correct value returned $b
Comments
Post a Comment