I have a txt file that I am reading from.
The file is formatted by ID NUMBER,DEPARTMENT Example:23942,English Always 5 digit ID number, department can vary in length.
The first step I was able to do, which was to pull from the first file anyone from the English department.
$x = Get-Content -Path C:\dep.txt | Where-Object {$_.Contains("English")}
This returns "00000,English 11111,English 22222,English......etc)"
However, now I am bit confused. For every ID NUMBER that gets returned, I need to store them into a separate variable.
Then I need to take those variables (let's just say a,b,c....etc) and compare them to a second text file that is formatted as LASTNAME,FIRSTNAME,ID NUMBER. Example Alex,Jones,29472 So using the variables (a,b,c,...etc) I need to locate the corresponding ID NUMBER and find the LASTNAME,FIRSTNAME that goes with it and write the name to names.txt
I'd appreciate any help I could get with this!