I have 2 .csv files.
Examples:
1.csv:
Users
userA
userB
2.csv:
groupid,user,random
1,userA,randomtext1
2,userA,randomtest2
3,userA,randomtext3
3,userB,randomtext1
5,userB,randomtext2
6,userB,randomtext2
I want to take the value of the one column in 1.csv and check it against a column in 2.csv.
Basically what output I would like is:
UserA is a member of 1
UserA is a member of 2
UserA is a member of 3
UserB is a member of 3
UserB is a member of 4
UserB is a member of 5
UserB is a member of 6
I know I can use Import-Csv but I just can't get around how to do this?
I have tried to put 1.csv into an array but how can i then check the array against every line in 2.csv to check if the user is on a given line and then take the groupip?
$user = @()
$users = Import-Csv 1.csv | Foreach {$user += $_.Users}
I have tried a lot of different things and i cant get it to work.
Any tips appreciated.
/Rasmus