Hello,
I am very new to Unix and need to work on this project. I am working in the training department. Our employees have to perform four tests to qualify the placement.
I have a flat file that contains the following format:
employee id:lastname: firstname:test1:test2:test3:test4.
Data with colon delimeters will look like the following -> 1001:SMITH:JOHN:86:78:80:89. There are several lines in this text file. Each test score is based on 100 points each.
I need to compute the average score and letter grade on each employee.
Average score formula should be: 50% of test1 + 20% of test2 + 10% of test3 + 20% of test4. The letter grade will be A/B/C/D, which is corresponding to 90/80/70/60 scale.
From the example above, John Smith will have the average score of : (50% * 86) + (20% * 78) + (10% *80) + (20% *89) which is equivalent to 84.4. That will be translated into a "B" grade.
My questions are:
1. How does Unix know to stop processing at the end of file since Unix does not have the end of file command? One recommendation that my friend has is to use the tail command and extract the last record into a temporary file. Then, run a comparison between this huge file and that temporary file. How can I accomplish this task? Do you have any suggestions?
When he talked about file comparison, is this what the diff command come in? However, how can I do it record by record? I am concerned because I might have over 1,000 records.
2. How can I do record count in Unix? Will wc -l work? Right now, I have one record per line.
The ultimate goal of this program is to run an output, using the awk command that will display -> student id, student name, course average and letter grade.
I am stuck on this one. I will be very much appreciated if you can enlighten me. Thank you.
I am very new to Unix and need to work on this project. I am working in the training department. Our employees have to perform four tests to qualify the placement.
I have a flat file that contains the following format:
employee id:lastname: firstname:test1:test2:test3:test4.
Data with colon delimeters will look like the following -> 1001:SMITH:JOHN:86:78:80:89. There are several lines in this text file. Each test score is based on 100 points each.
I need to compute the average score and letter grade on each employee.
Average score formula should be: 50% of test1 + 20% of test2 + 10% of test3 + 20% of test4. The letter grade will be A/B/C/D, which is corresponding to 90/80/70/60 scale.
From the example above, John Smith will have the average score of : (50% * 86) + (20% * 78) + (10% *80) + (20% *89) which is equivalent to 84.4. That will be translated into a "B" grade.
My questions are:
1. How does Unix know to stop processing at the end of file since Unix does not have the end of file command? One recommendation that my friend has is to use the tail command and extract the last record into a temporary file. Then, run a comparison between this huge file and that temporary file. How can I accomplish this task? Do you have any suggestions?
When he talked about file comparison, is this what the diff command come in? However, how can I do it record by record? I am concerned because I might have over 1,000 records.
2. How can I do record count in Unix? Will wc -l work? Right now, I have one record per line.
The ultimate goal of this program is to run an output, using the awk command that will display -> student id, student name, course average and letter grade.
I am stuck on this one. I will be very much appreciated if you can enlighten me. Thank you.