 OPA JUNE 19 Unix

Student details are stored in following format:

Roll no, Name, Standard, Science_Score, Mathematics_Score, SchoolName
Write the unix command to display all the fields in the same order as above for all the students whose score is more than 80 in mathematics and mathematics score should be the top score, among all the subjects for the respective student . The student details are to be displayed sorted in the ascending order of Standard (in which student studying) and ascending order of Mathematics score(If first sort parameter value is same for two or more students).

Refer sample test case below for more details.

The student details are provided as command line argument when the file containing your command will run. Use appropriate command line argument(\$1,\$2)
Input:

♦ Sample test case

Test case Input

1,RajaR,9,60,85,SM
2,Pooja,10,85,80,DAV
3,RaghuRam,10,95,92,DAV
4,Akhil,9,60,55,SM
5,Bharath,10,80,88,SM
6,Chandra,9,75,92,DAV

Test case output:

1|RajaR|9|60|85|SM

6|Chandra|9|75|92|DAV

5|Bharath|10|80|88|SM

Explanation

The students , whose score is greater than 80 in mathematics and the Mathematics score is more than other subject(science) score are: RajaR ,Chandra,Bharath, After sorting the filtered records as per given requirement the output will be as below.
11RajaRI9160185ISM 61Chandra19175192IDAV 51Bharathl10180188ISM
The above records displayed 9th class students first and later 10th class students nect but there are two students with 9th standard and hence the two records inturn sorted in the ascending order of Mathematics score. Here records are sorted using two sort parameters (standard and Mathematics score) in one go, ie two level sorting. Note: Extra line of space should not be there in between the output records .
Two level sorting means , Records will be sorted using second sort parameter / argument(Mathematics in this example) if and only if there are multiple records having the same value(for a field / column) after first level of sorting wrt the first sort parameter(Standard in this example).

Solutions: