Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given files: names.txt a file with many records each record in a line by itself. Each record consists of students name (may contain spaces) and

Given files:

names.txt a file with many records each record in a line by itself. Each record consists of students name (may contain spaces) and student ID separated by a tab

courses.txt a file with many records each record in a line by itself. Each record consists of ID, course name (no spaces) and grade separated by tabs. An empty grade means in progress

Write a shell script to do the following:

The script runs as; nameofscript followed by arguments (command line arguments)

First, the script checks if the above two files do exist, if they do it will continue processing based on the arguments, if one or both files do not exist, it printsOne or both files do not existing. Then it quits.

Based on the arguments, the script does the following:

-count the script displays the number of students in the first file and quits

-f student name it displays all the courses that students has taken and his/her grade separated by a tab (if the course is in progress, it display in progress instead of the grade). if that student does not exist, it displays No such student: followed by the student name

-g student name it displays all the courses that students has completed (has a grade in) in the above mentioned format.

-c course name displays the number of students registered in this course

-list course grade displays the number of students in this course who achieved this grade

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions