" Band,Album,Year Fugazi,In On The Kill Taker,1993 Fugazi,The Argument,2001{$x} Fugazi,7 Songs,1988 Fugazi,Repeater,1990 Fugazi,Steady Diet of Nothing,1991 " | save -f /tmp/test.txt #-s is skip empty lines let data = open /tmp/test.txt | lines -s | split column "," Band Album Year | skip 1 | sort-by Year $data | each { |row| $row.Band + ":" + $row.Album + ":" + $row.Year } $data |to csv