Use awk to handle student score ranking cases

Source: Internet
Author: User

The real case of using awk to handle student score rankings is as follows:

1, known to the old Boys education operation and Maintenance class 26 mid-term cluster structure on stage reporting personnel scores are:

Tip: The cluster structure of the lectures by the students on the stage, by the student judges and mentors scored, after 2 days to produce the following ratings

[[Email protected] ~]# cat oldboy_student.txt Fengquan     100      100     96      95       100     96      100      97 Wan Yongzhen   100     95      90       88      95      98       95      98 Liang Wai   100      100     90      98       90      98      100      96 Cao Yanan   100     100     95       90      97      90       95      98 Chen Paiyu   90      95       95      96       100     98      100      96 Li Feng     90      90      90       85      92       95      95      98 余连辉   90       93      95      92       95      95       96      95 Houya   90      96      97       90      90      85       95      90 王续     85       92      98      98       90      95 Thunder     92       92      96      90       90      80 苏浩智   88       96      85      95       90      90 Xu Denghui   85       95      88      90      90       90 Lin Zhangyi   91      97       98      90      100      90 Huangpingqing   85      97       88      90      90       90 Li Jian     85      95       90      88      80       80 Cangan   88      95      90       88      90       100 Wanliang     89      95      95       88      100     100 马自强   88       97      90      88       90      90   88   , Crown Asia    97      98      90       100     100

Now ask to remove a top score, a minimum score, and then calculate the learner's average score, sort!

2, the sequencing program is as follows (the program from the student Hou Pengfei ("Learn from the old boy Linux Three Musketeers command book author" internal release )

[[email protected] ~]# cat oldboy.awk {         name=$1        MAX=$2         MIN=$2        total=$2         for  (x=3;x<=nf;x++) {                 if ($x >=max) {                     max= $x                  }                 if ($x <=min) {                     min= $x                  }                 total+= $x         }         num=total-max-min        avar=num/(NF-3)          printf  "%-5.3s max=%3d   min=%2d  avar= %0.2f\n ",  name,max,min,avar}

3, processing results

[[email protected] ~]# awk -f oldboy.awk oldboy_student.txt|sort -t =  -rnk4|nl     1   Fengquan     MAX=100    MIN=95&NBSP;&NBSP;AVAR=98.17&NBSP;&NBSP;&NBSP;&NBSP;#&LT;==26 champion      2   Liang Wai    max=100   min=90  avar=97.00   #<==26 Period runner       3   Chen Paiyu    max=100   min=90  avar= 96.67   #<==26 period tan Hua      4   ren    max=100    MIN=88  avar=96.25     5   Cao Yanan     max=100   min=90  avar=95.83     6   万永振     MAX=100   MIN=88  avar=95.17     7   Wan Liang     max=100   min=88  avar=94.75     8   余连辉     MAX= 96   MIN=90  avar=94.17     9   Lin Zhangyi    MAX=100   MIN=90  avar=94.00    10   Wang Yu     max= 98   min=85  avar=93.75    11    Li Feng     MAX= 98   MIN=85  avar=92.00     12   Houya    max= 97   min=85  avar=91.83     13   Wei Lei     MAX= 96   MIN=80   avar=91.00    14   Su Haozhi    max= 96   min= 85  avar=90.75    15   Cangan    MAX=100    min=88  avar=90.75    16   Xu Denghui    max= 95   min=85  avar =89.50    17   Mazhichang    MAX= 97   MIN=88   avar=89.50    18   Huangpingqing    max= 97   min= 85  avar=89.50    19   Li Jian     MAX= 95    min=80  avar=85.75

4, 26 students total of about 80 people, the first two days of attendance 19 people, debriefing video worldwide free sharing

Baidu Cloud Share: http://yun.baidu.com/share/link?shareid=592899567&uk=789116898

360 Cloud Share: Http://yunpan.cn/cjJ4rWaT8bVRS Extract Code 1e89

Welcome all netizens to appreciate and verify the teaching effect of the old boy's education

About 80% of the students have realized a key to automate the installation of 10 server clusters, this is only half of the course yo!

Oldboy-1-Small and medium-sized cluster Project real-time sharing debriefing-old boy Yun-dimensional class 26 Fengquan-Drawing elder brother Avi

oldboy-2-Small and medium-sized cluster Project real-time sharing debriefing-old boy Yun-dimensional class 26 Wan Yongzhen-Magnum. avi

oldboy-3-Small and medium-sized cluster Project real-time sharing debriefing-old boy Yun-dimensional class 26 Xu Liangwei-thought elder brother. avi

oldboy-4-Small and medium-sized cluster Project real-time sharing debriefing-old boy Yun-dimensional class 26 Cao Yanan-Doc. avi

oldboy-5-Small and medium-sized cluster Project real-time sharing debriefing-old boy Yun-dimensional class 26 Chen Paiyu. avi

oldboy-6-Small and medium-sized cluster Project real-time sharing debriefing-old boy Yun-dimensional class 26 Li Feng. avi

oldboy-7-Small and medium-sized cluster Project real-time sharing debriefing-old boy Yun class 26-Yu Lianhui-script brother Avi

oldboy-8-Small and medium-sized cluster Project real-time sharing debriefing-old boy Yun-dimensional class 26-Houya-ppt. avi

oldboy-9-Small and medium-sized cluster Project real-time sharing debriefing-old boy Yun-Ban 26 period Wang continued. avi

oldboy-10-Small and medium-sized cluster Project real-time sharing debriefing-old boy Yun-Wei class 26-Wei Lei-Thor brother. avi

Issue 23:

oldboy1-old boy 23-year interim framework debriefing-he 1.mp4

oldboy2-old boy 23-year interim framework debriefing-he 2.mp4

oldboy3-Small and medium-sized cluster Project real-time sharing debriefing-old boy 23 except Sheedi. mp4

oldboy4-Small and medium-sized cluster Project real-time sharing debriefing-old boy 23 Yuanfang. mp4

oldboy5-Automation installation Small and medium-sized cluster project combat-old boy 23 Lee thought. mp4

5, the old boy education students average employment wages, for many years in the country ranked absolute first position, far away from all peer Agencies N Street, students follow the development momentum is a wave high over a wave, incomplete statistics, operation and maintenance manager and Director level of students not less than 50, More than 300,000 of the annual salary of hundreds of.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/77/C6/wKioL1ZuOnfhwiKKAAHJXTUkBRE069.png "width=" 883 " Height= "616" alt= "Wkiol1zuonfhwikkaahjxtukbre069.png"/>

If you also want to master the Linux Awk,sed,grep Musketeers, you can Contact Blog Home published old boys education counselor teacher free access "Learn from the old boy Linux Three Musketeers command book author" an electronic version!

This article is from the "Old boy Linux ops" blog, please be sure to keep this source http://oldboy.blog.51cto.com/2561410/1725148

Use awk to handle student score ranking cases

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.