Powershell counting same values from csv

后端 未结 2 1831
半阙折子戏
半阙折子戏 2021-01-27 17:03

Using PowerShell, I can import the CSV file and count how many objects are equal to \"a\". For example,

@(Import-csv location | where-Object{$_.id -eq \"a\"}).Co         


        
2条回答
  •  轮回少年
    2021-01-27 17:33

    Try cycling through properties like this:

    (Import-Csv location | %{$record = $_; $record | Get-Member -MemberType Properties | 
        ?{$record.$($_.Name) -eq 'a';}}).Count
    

提交回复
热议问题