Ryan
Ryan

Reputation: 2051

Powershell sort float data in csv

I use this command:

import-csv my.csv | select Date, Balance | sort Balance | select -first 10

The Balance column is float data, but it is sorted as string. How to sort it as number?

Upvotes: 1

Views: 1019

Answers (1)

CB.
CB.

Reputation: 60958

try:

import-csv my.csv | select Date, Balance | sort {[double]$_.Balance} | select -first 10

Upvotes: 2

Related Questions