Consider the file having following fields:
D_Id;D_Name;No_Of_Students
The field delimiter for the file is ";".
Write the Unix command to find the department which has highest
number of students.
If two departments have equal number of students then sort on
the basis of department name in descending order and print the last
department name sorted.
The output should be as below: <the value found>
Refer the example below for more clarity on input and output
format.
The file name input will be provided as command line argument
when the script containing your command will run. You can use shell
variables (e.g. $0,$1,$2) whichever is applicable for your
requirement to provide the command line argument.
Sample test Case 1 D_ID;D_Name;No_of_Students
1;Electrical;30
2;Civil;40
3;CSE:80
4;Mechanical; 10
5;ECE:30
Output 1
CSE
Sample Test Case 2
D_ID;D_Name;No_of_Students 3;Electrical;90
1;CSE;90
2;Mechanical;80
3;Electrical;90
4;ECE;90
Output 2
CSE
Please write the cord using Awk comand
Consider the file having following fields: D_Id;D_Name;No_Of_Students The field delimiter for the file is ";". Write the
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am