Using vi to create bash shell script
Need to find out how to calculate the highest mark and lowest mark in a list of grades.
|
Really you're not asking about vi at all, you're asking how to sort a list and get the highest and lowest values. sort, head and tail are commands that you'll want to use.
|
shell script help
The script must warn if a student is missing a mark or if the mark is unreadable (e.g. a letter instead of a number) from a list of student names and grades.
|
Instead of creating lots of threads for what appears to be the same problem, you should really just have one thread in which you describe what you're trying to do in full, where you're stuck, etc.
|
Okay this is what I'm stuck on in full.
The file contains student names and grades in the following format:
#Name Marks Joe Munson 92 Bob Smith 45 Jill Taylor 85 Jane Hathaway 65 Elliot Parsons 72 Mike Jackson 0 The script must be able to handle files of varying number of lines The script must warn if a student is missing a mark or if the mark is unreadable (e.g. a letter instead of a number). The script will calculate the class average, the highest mark and the lowest mark. The output display shold look like this: The name of the file is: studentmarks.txt The class average is: 59.8% The highest mark is: 92 (Joe Munson) The lowest mark is : 0 (Mike Jackson) Quote:
|
Quote:
Quote:
And like Nylex already asked you: please post whatever script or pseudo script you have and we'll help you correct and add things. |
Quote:
Code:
sort -g grades |sed -n -e '1p' -e '$p' Cheers, Tink |
Quote:
Quote:
And besides, the actual question makes it seem like it could be the teacher wanting to write a script for themselves to do their own type of automated reporting, etc. |
Either way, I think we'd still like to see an attempted script.
;) http://catb.org/~esr/faqs/smart-questions.html |
All times are GMT -5. The time now is 01:42 PM. |