I'm looking for a command-line (ideally) solution that lets me sort the lines in a file by comparing each line from right to left.
For example...
Input:
aabc
caab
bcaa
abca
Output:
bcaa
abca
caab
aabc
I'll select the answer which I think will be the easiest to remember in a year when I've forgotten I posted this question, but I'll also upvote clever/short answers as well.
The easiest to remember would be
reverse < input | sort | reverse
You will have to write a reverse
command though. Under Linux, there's rev
.