Sorting by Specific Column in PowerShell

Hello Folks,

I needed a script in Poweshell which sorts the data by specific column. I wanted to share it on my blog as I do not see much examples over the Internet.

Let’s say you have data as below and you want to sort this data by specific column. In this example I sort the data by

Elapsed Time.

Fields are in the sample data delimited by multiple space–in Regex terms (\s+)

Fields are; Batch Name Status Stage Batch Batch Date Start Time End Time Elapsed Time Avg. Elapsed Time


Sorting Script




Happy Scripting 🙂