06-17-2010
176,
5
Join Date: Oct 2008
Last Activity: 11 November 2015, 6:40 PM EST
Location: Orem, Utah
Posts: 176
Thanks Given: 16
Thanked 5 Times in 5 Posts
Arbitrary sort orders
So, suppose I want to sort something in some arbitrary order... for example, let's say I have "grades" (actually, work evaluation results where I work) that are, from best to worst, E, A, S, D, P. So, I want to sort by a "grade" column with the E's first, then the A's, etc. Is there a reasonably straightforward way to create an arbitrary sort order like this? It can be done readily in awk and other languages, but I'm wondering about the sort command itself.
Another application might also be sorting -h output for the ls or du commands-- sort order T, G, M, K, B (or nothing).