Unix HW
|
[Spring 2018] |
IFT 250: Shell & Script Programming with Unix |
Part I: Oh no, not again
Consider the file roster which can be found on BlackBoard and will be uploaded to your home directory.
The format is:
"student ID","Posting ID","First Name","Last Name","Units","Grading Scale","School – Major","Academic Level","ASURITE","Residency"
Provide the commands used to preform the following tasks:
1. Move the roster file to the ~/IFT250/Exams/Final directory.
2. Change your working directory to ~/IFT250/Exams/Final.
3. Use vi to replace all commas with spaces and save the file as viRoster.
4. Do the same without vi and save the output as newRoster.
5. Compare the viRoster and newRoster files line by line and display the lines that are different.
6. Find all instances of the word "Technology" in the viRoster and save the output as uglyRoster.
7. Use vi to create a file named head that contains the field names written above, insert the viRoster file into the head file, and save it as badRoster.
8. Format the viRoster file using vi so that it matches the example below and save it as goodRoster.
Last Name:First Name:Student ID:School:Major:Residency:Academic Level:ASURITE
9. Display the number of students in the goodRoster file that are in the IT program.
10. Display the number of students in the goodRoster file that are both a senior and a resident.
Part II: Well this is AWKward
Consider the file classroster which can be found on BlackBoard.
The format is:
"student ID","Posting ID","First Name","Last Name","Units","Grading Scale","School – Major","Academic Level","ASURITE","Residency"
Create an awk script named exam.awk that will output a header of the field names shown below and each of the entries in the following format:
Last Name:First Name:Student ID:School – Major:Academic Level:ASURITE:Email
With the Email field of the following format:
[email protected]
In addition to this, your script will display the number of students in the IT program and in each of the academic levels
The script will run from the command prompt using the following command:
awk –f exam.awk classroster
Capture a screenshot of the output and include it in your submission.
part III: So Long and Thanks for the Perl
Create a perl script named exam.pl that meets the following criteria:
1. Constant values to store the maximum value of each component.
|
Component |
Total Max |
|
Quiz |
10 |
|
Class Activities |
135 |
|
Homework |
150 |
|
Labs |
155 |
|
Discussion |
105 |
|
Exams |
180 |
2. A function that will take an array of values and return the sum.
3. A function that will take two values and return the percentage of the first in relation two the second.
4. A function that will take a percentage grade and return the letter grade based on the following rubric:
|
Percentage |
Letter Grade |
Percentage |
Letter Grade |
|
>= 95.0 <= 100.0 |
A+ |
>= 80.0 < 82.5 |
B- |
|
>= 90.0 < 95.0 |
A |
>= 77.5 < 80.0 |
C+ |
|
>= 87.5 < 90.0 |
A- |
>= 70.0 < 77.5 |
C |
|
>= 85.0 < 87.5 |
B+ |
>= 60.0 < 70.0 |
D |
|
>= 82.5 < 85.0 |
B |
< 60 |
F |
5. A hash of components that will be used to store grade values for calculation.
Your script will prompt the user for the score of each component and store it in the respective hash value then return the final score and letter grade.
Capture a screenshot of the output and include it in your submission.
Submissions
Once you’ve completed all the activities, perform the following steps for
submission:
1. Make sure all of your answers are correct and complete.
Page | 5