Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

ForEach group duplicates and export to csv files

$
0
0

I have a project due that requires me to extrapolate data based on an email address field. There are many duplicates and I need all of them for each email address output to a csv file. I'm really stuck. I've tried many ways to do this, but nothing is working. Here are the headers of the file I'm working with. StudentNumber,GradeLevel,FirstName,LastName,Course_number.SectionNumber,CourseName,Room,TeacherEMail,ChromeBookNumber,TowerNumber,InsuranceFee,PermissionTakeHome,DigitalCitizenship,ChargerCondReturned,ChromebookReturned,ChargertoStudent,ChargertoTeacher

I have a separate csv file with a list of all the email addresses. I need PowerShell to import the email addresses and pull the records that match each one and send to csv files with a name scheme of date.username.

I just need to get something to work and I'm stuck. I would appreciate any help. TIA.

$AGI_Chromebooks = "C:\agsd\data\20180820_AGI_AUPChromebooks.csv"
Import-csv $AGI_Chromebooks | Group-Object |
    where-object {$_.teacheremail -eq "user@myagsd.net"} |
    Export-Csv "C:\AGSD\data\chromebooktesting.csv"


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>