I am looking for a way to rank values in a csv column in powershell, similar to python in which you would read the column into list

Pass the csv column into a powershell list? Or use a powershell module? I am trying to count the frequency of IP addresses in a device log, thanks!

Your description is a bit vague. I assume you’ve heard about Import-Csv or haven’t you? If not - please read the complete help topic including the examples to learn how to use it

1 Like

As well Import-CSV, you might look at Group-Object.

Example, using ConvertFrom-Csv in lieu of Import-Csv:

$data = @'

$csv = $data | ConvertFrom-Csv
$csv | Group-Object IP


Count Name                      Group
----- ----                      -----
    3                  {@{IP=; ComputerName=host1}, @{IP=; ComputerName=host3}, @{IP=; ComputerName=host3}}
    2                  {@{IP=; ComputerName=host2}, @{IP=; ComputerName=host4}}
    1                  {@{IP=; ComputerName=host5}}
1 Like