I have a bunch of files that contain users one per line. I want to use
get-content | group-object to get the common occurences of each user one per
line, showing the total and then the list of files that contain the user.
If there are more files than will fill the screen, the group column gets
truncated (see the ... below):
# Get-Content "c:\temp\Users\*.txt" | group-object
Count Name Group
----- ---- -----
20 bspadmin {appu1g1.txt, Copy (2) of appu1g1.txt, Copy
(2) of appu1g2.txt, Copy (3) of appu1g1....
20 oracle {appu1g1.txt, Copy (2) of appu1g1.txt, Copy
(2) of appu1g2.txt, Copy (3) of appu1g1....
20 u141562 {appu1g1.txt, Copy (2) of appu1g1.txt, Copy
(2) of appu1g2.txt, Copy (3) of appu1g1....
If I have a few files they fit on the screen:
5 u602188 {appu1b6.txt, appu1g1.txt, appu1g2.txt,
appu470.txt, dbsu1g1.txt}
5 u452413 {appu1b6.txt, appu1g1.txt, appu1g2.txt,
appu470.txt, dbsu1g1.txt}
4 u475854 {appu1b6.txt, appu1g1.txt, appu1g2.txt,
appu470.txt}
4 u445383 {appu1b6.txt, appu1g1.txt, appu1g2.txt,
appu470.txt}
4 u485710 {appu1b6.txt, appu1g1.txt, appu1g2.txt,
appu470.txt}
I would really like to export ALL this data to a csv file, but using I get
garbage for output:
Get-Content "c:\temp\Users\*.txt" | Group-Object | Sort-Object count -desc |
Export-Csv -path c:\temp\foo.csv
#TYPE Microsoft.PowerShell.Commands.GroupInfo
Values Count Group Name
System.Collections.ArrayList 5 System.Collections.ObjectModel.Collection`1[System.Management.Automation.PSObject] u151170
System.Collections.ArrayList 5 System.Collections.ObjectModel.Collection`1[System.Management.Automation.PSObject] u152379
How can I get usable information for output?
Thanks,
Tolli


