01-26-2019, 01:14 AM
If you already have the text inside a program such as a word processor and don't want to save it to a separate plain text file...
Highlight the text.
Copy.
At the Terminal command prompt type "pbpaste | sort | pbcopy" and hit return.
Go back to your word processor and Paste.
The selection will be replaced with the text sorted.
By default it will be sorted alphabetically in ascending order.
To sort in descending order use "pbpaste | sort -r | pbcopy"
To sort in ascending numerical order use "pbpaste | sort -n | pbcopy"
To sort in descending numerical order use "pbpaste | sort -nr | pbcopy"
Highlight the text.
Copy.
At the Terminal command prompt type "pbpaste | sort | pbcopy" and hit return.
Go back to your word processor and Paste.
The selection will be replaced with the text sorted.
By default it will be sorted alphabetically in ascending order.
To sort in descending order use "pbpaste | sort -r | pbcopy"
To sort in ascending numerical order use "pbpaste | sort -n | pbcopy"
To sort in descending numerical order use "pbpaste | sort -nr | pbcopy"