'Using awk and sort last column in descending order in Linux

I have a file contains both name and numbers like : data.csv

2016,Bmw,M2,2 Total score:24

1998,Subaru,Legacy,23 Total score:62

2012,Volkswagen,Golf,59 Total score:28

2001,Dodge,Viper,42 Total score:8

2014,Honda,Accord,83 Total score:112

2015,Chevy,Camaro,0 Total score:0

2008,Honda,Accord,88 Total score:48

Total score is last column I did :

awk -F","  'NR>1{{for(i=4;i<=6;++i)printf $i""FS }
                                         {sum=0; for(g=8;g<=NF;g++)
                                         sum+=$g
                                         print $i,"Total score:"sum ; print ""}}' data.csv

when i try

 awk -F","  'NR>1{{for(i=4;i<=6;++i)printf $i""FS }
                                          {sum=0; for(g=8;g<=NF;g++)
                                         sum+=$g
                                          print $i,"Total score:"sum ; print "" | "sort -k1,2n"}}' data.csv

It gave me error, I only want to sort total score column, is there anything I did it wrong? Any helps are appreciated



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source