Mohit Arora Mohit Arora - 8 months ago 44
Bash Question

Unix sorting mutiple conditions

I have a file in which there are numbers like

and so on

I want them to be groped/sorted as

Basically EH ones together in ascending then C together in ascending and then the rest in ascending.

I am trying
sort -k 1.10,1.14 -nr | sort -k 1.13 -r
but not getting the exact output.

Any help would be much appreciated. Thanks in advance


Will this work for you sort -r -t. -k5.4 somefile.txt