Suppose we have this file:
test>>cat file
10.Gryffindor
4.Hogwarts
2.Harry
3.Dumbledore
1.The sorting hat
To sort this file numerically, use sort with -n option:
test>>sort -n file
This should sort the file as below:
1.The sorting hat
2.Harry
3.Dumbledore
4.Hogwarts
10.Gryffindor
Reversing sort order: To reverse the order of the sort use the -r option
To reverse the sort order of the above file use:
sort -rn file
This should sort the file as below:
10.Gryffindor
4.Hogwarts
3.Dumbledore
2.Harry
1.The sorting hat