我有一个包含受感染计算机列表的CSV文件。我想获得一个列表,其中包含每个国家/地区的受感染计算机数量。
英国电脑
PC1002
PC1002
PC1003
PC1004
PC1004
PC1004
PC1004
法国电脑
FR2002
FR2004
德国PC
DE3003
因此表的格式应为:
PC1 = 7
FR2 = 2
DE3 = 1
更新CSV文件。
ComputerName DetectionTime UserName Process ThreatName Path Severity Category CleaningAction ExecutionStatus ActionSuccess PendingActions ErrorCode RemainingActions LastRemainingActionsCleanTime
PC1002 10/06/2016 09:47 SYSTEM Unknown PUA:Win32/DownloadSponsor file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85 Severe Potentially Unwanted Software 3 0 TRUE 0 0 0
PC1002 10/06/2016 09:47 SYSTEM Unknown PUA:Win32/DownloadSponsor file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85 Severe Potentially Unwanted Software 3 0 TRUE 0 0 0
PC1003 10/06/2016 09:47 SYSTEM Unknown PUA:Win32/DownloadSponsor file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85 Severe Potentially Unwanted Software 3 0 TRUE 0 0 0
PC1004 10/06/2016 09:47 SYSTEM Unknown PUA:Win32/DownloadSponsor file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85 Severe Potentially Unwanted Software 3 0 TRUE 0 0 0
PC1004 10/06/2016 09:47 SYSTEM Unknown PUA:Win32/DownloadSponsor file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85 Severe Potentially Unwanted Software 3 0 TRUE 0 0 0
PC1004 10/06/2016 09:47 SYSTEM Unknown PUA:Win32/DownloadSponsor file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85 Severe Potentially Unwanted Software 3 0 TRUE 0 0 0
PC1004 10/06/2016 09:47 SYSTEM Unknown PUA:Win32/DownloadSponsor file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85 Severe Potentially Unwanted Software 3 0 TRUE 0 0 0
FR2002 11/06/2016 09:47 SYSTEM Unknown PUA:Win32/DownloadSponsor file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85 Severe Potentially Unwanted Software 3 0 TRUE 0 0 0
FR2004 12/06/2016 09:47 SYSTEM Unknown PUA:Win32/DownloadSponsor file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85 Severe Potentially Unwanted Software 3 0 TRUE 0 0 0
DE3003 13/06/2016 09:47 SYSTEM Unknown PUA:Win32/DownloadSponsor file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85;file:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{5D31A17F-8C42-4E61-A22C-FE4298BD8EBA}-BDA76FD6-F4D2-4274-2A10-28E5A595686F_1d1c3c632120f5d|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\LocalCopy\{EE7FA0FA-19AA-4E29-A6AE-7338C3BE10F8}-7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85|iexplore.exe;webfile:_c:\ProgramData\Microsoft\Microsoft Antimalware\Scans\FilesStash\7ADD9B4F-194E-B272-C4FA-B5996C31067C_1d1c3c62e702f85 Severe Potentially Unwanted Software 3 0 TRUE 0 0 0
答案 0 :(得分:0)
如果它只是一个包含一行的文件(你没有向我们展示csv结构)。您可以使用Get-Content
cmdlet加载文件,并使用Group-Object
cmdlet确定计数:
Get-Content "your_path_here" | select -Skip 1 |
Group { $_ -replace '([a-zA-Z]+)(.).*', '$1$2' } |
ForEach-Object { '{0} = {1}' -f $_.Name, $_.Count }
<强>输出:强>
PC1 = 7
PC2 = 2
PC3 = 1
使用正则表达式:
([a-zA-Z]+)(.).*