Link to home
Start Free TrialLog in
Avatar of D B
D BFlag for United States of America

asked on

Get Value of Array Element (Key/Value Pair)

Okay, I have learned a lot today, but really having an issue with this one. I have created an array using import-csv. It has two columns. I want to use the first column as a key and return the value in the second column.
I am sure, knowing PowerShell, that there is probably a very simple way of doing it, but what I've got now is:
$a = $ClientList | Where-Object client_id -EQ "123" | select client_name
So, if $ClientList contains:
client_id,client_name
111,John Smith
123,Jane Doe
...
I want to populate $a with "Jane Doe"
However, whet I end up with is:
client_name
-----------
Jane Doe
How do I return ONLY "Jane Doe" without the header?
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of D B

ASKER

Super!
Thanks. I love doing research and tryiing to find this stuff out myself, but sometimes it gets so frustrating. You spend two hours looking for an answer using Google, can't find it, ask an expert and in 5 minutes you have your answer. Love it!