Wednesday, April 7, 2010

Mitch's b*tches (1 of many)

In the olden days when I typed at Unix to get work done, if I had a few million numbers in a file and wanted to count how many of each number occurred, I could type:

$ sort -n < file uniq -c

and I had the result. Now, in PowerShell, I must type:

get-content file.txt sort {[void]($match '\d*');[int]$matches[0]} group-object format-table count,name

There is no -n (numeric) option in powershell's sort. Whiskey, Tango, Fargo, over?