Script not working..."sort" not working properly....

After using the entire file you posted I see that the output file is sorted incorrectly and here's the fix...

awk '{printf "%s/%s = %f\n", $11, $5,$11/$5}' file | sort -k3rn

@Rahul,

I tried the below command in my AIX for your input file 12.txt (with 3052 records).

cat 12.txt | awk '{ printf "%s/%s = %3.3f\n", $11, $5, $11/$5}' | sort -k3,3nr | head -20

This gives the top 20 sorted output. The output was as below, which seems to be correct.

41.095447/2 = 20.548
47.139053/3 = 15.713
9.396545/1 = 9.397
9.039183/1 = 9.039
76.712522/10 = 7.671
6.857941/1 = 6.858
18.470404/3 = 6.157
4.516811/1 = 4.517
4.214784/1 = 4.215
4.043929/1 = 4.044
3.868609/1 = 3.869
3.442802/1 = 3.443
3.198656/1 = 3.199
2.967361/1 = 2.967
11.660539/4 = 2.915
2.599642/1 = 2.600
7.414902/3 = 2.472
2.375463/1 = 2.375
4.402904/2 = 2.201
2.123307/1 = 2.123

Use this command.

I hope u vil get the proper output.

awk '{ printf "%s/%s = %3.3f\n", $11, $5, $11/$5}' 12.txt | sort -r -k3,3n | head -30

Thank you.

That won't sort correctly because by itself "-r" stands for the entire record instead of the 3rd field only when specified as -k3,3r.