Help with awk sorting with different values

Hello,

I have a file as follows:

BTA Pos KLD

4    79.7011    5.7711028907

4     79.6231    5.7083918219

5    20.9112    4.5559494707

5    58.0002    3.4423546273

6    38.2569    4.7108176788

6    18.3889    7.3631759258

I want to sort the second column based on each values in the first column, that is forexample sorting for BTA 4, then for BTA 5, then for BTA 6 and so on to have this output:

4     79.6231    5.7083918219

4    79.7011    5.7711028907

5    20.9112    4.5559494707

5    58.0002    3.4423546273

6    18.3889    7.3631759258

6    38.2569    4.7108176788

Thank you in advance.

Try:

sort -k1,2n file | awk NF ORS='\n\n'

The awk bit is used to remove and add the empty lines ..