Sale!

CSE 2031 Lab 8 solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (4 votes)

Problem 1
A database table is a collection of records where each record has a unique field
(different from any other record). That field is knows as the key.
Your database consists of 2 files
File 1 Student names. This file consists of many records each one of them is on
the format
Key firstname lastname, separated by spaces. For example
John12 John Dow
Jane12 Jane Dow
File 2
StudentID Key, averagemark, also separated by spaces. For example
1234567844 Jane12 92
9876543212 John12 45
Write a shell script that takes 2 command line arguments File1 and File 2
Lab8a.sh file1 file2
The script cross reference these 2 files and displays on the standard output
students grades as follows
lastname, Firstname mark separated by one space.
Consider the example above. The program takes fromfile1 first name and last
name and the key. Using the key, the program gets from the second file the
mark. Then it displays them as follows.
Dow, John 45
Dow, Jane 92
The order is the order of names in file 1
For simplicity, assume that the keys is not a part of any other field in any record
Problem 2
In this part, we will expand a little bit on the previous case.
The file formats are
File 1 File 2
key Fname Lname StudentID key mark1 mark2 mark3
If the program is called
Lab8b.sh file1 file2
First if the script is called with less than 2 arguments, the program should output
the following message and quits
Error: needs two files
If one (or two) of the files is a directory, or unreadable, or doesn’t exist, the
message is displayed
Error: There is a problem with one of the files
The the program bhaves like in problem 1
If the call is
Lab8b.sh file1 file2 avg
In this case, the third argument is “avg”
The program displays the same information as part 1 and the average mark
(integer).
If the call is
Lab8b.sh file1 file2 -F
In this case, the third argument is “-F”
The program displays the same information as part 1 only for those students with
average less than 50%
If the script is called with any third arguments other than the above 2, the script
should display
Error: avg of -F only please