I guess we clearly do not understand what you mean when you say:
I suggested using sort -t, -k2,2n medium.txt
which you say produced the output:
58,1
30,2
39,3
57,3
72,3
61,5
7,5
85,6
23,7
71,7
21,9
19,10
0,11
20,11
38,11
14,13
54,13
100,14
34,14
39,14
50,15
31,18
50,18
67,18
51,20
which seems to be exactly what you requested (the second column is sorted with increasing numeric values from 1 to 20). If you meant that you wanted to sort the file with the 2nd field as a primary key and the 1st field as the secondary key with both fields sorted numerically, that could be done with any of the commands:
sort -t, -n -k2,2 -k1,1 file
sort -t, -k2,2n -k1,1n file
sort -nt, -k2,2 -k1,1 file
Instead you claim that the output:
0,11
7,5
14,13
19,10
20,11
21,9
23,7
30,2
31,18
34,14
38,11
39,14
39,3
50,15
50,18
51,20
54,13
57,3
58,1
61,5
67,18
71,7
72,3
85,6
100,14
is the output you want even though it seems to be sorted numerically on the 1st column; not the 2nd column as you requested???
Did we misunderstand what you meant when you said you wanted to sort the 2nd column numerically?
Did we misunderstand what you meant when you said the comma was your column separator?
What locale settings are you using for LC_NUMERIC and LC_COLLATE?
What operating system are you using?