Post

Handy #PowerShell one-liner of the day: Alphabetize whatever is on the clipboard: ~~~PowerShell @(@(Get-Clipboard) -split '(?>\r\n|\n)' | Sort-Object) -join [Environment]::NewLine | Set-Clipboard ~~~

Here's what I like. Add `-Unique` for distinct ~~~Powershell (Get-Clipboard -Raw) -split '\r?\n' | Sort-Object -Unique ~~~ Is there a difference with your regex and @() output? I appear to get the same results I tested mixing nested newlines in the array #Powershell

It does not. It just puts the result in an array. In this case I can probably get by with () or $(), because there can only be one item on the clipboard at a given time.

0 reposts0 likes

No replies yet.