Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Entries from 2017-04-01 to 1 day

You can't sort strings in ASCII order

When you pass chars to Sort-Object, the chars sorted in ASCII order. PS > (0x7E..0x21 | ForEach-Object { [char]$_ } | Sort-Object) -join '' !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ But …

Difference of Sort-Object -Unique, Sort-Object | Get-Unique, and Select-Object -Unique

If you want to uniq a list in PowerShell, there is more than one way to do it and these are slightly different. # Cmdlets Sort-Object -Unique Sort-Object | Get-Unique Select-Object -Unique 1 Sort elements Yes Yes No 2 Case sensitive in ded…