Find the Maximum value and average of a column

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:
    I am trying to complete a script which will allow me to find:
    a) reads a value from the keyboard. (ask the user to provide a value)
    b) reads each line from the "sercel_output2.3" file in a loop until it finds the value you are looking for
    c) counts the occurrences of the value provided
    Unitl here I can run the script but I am having trouble with the following two points. I can not use awk
    d) fiind the maximum value in the column(there is only one column in the file)
    e) calculate the average of the column. ( I only have one point after the decimal)

  2. Relevant commands, code, scripts, algorithms:

can not use awk

  1. The attempts at a solution (include all code and scripts):
echo "Please Provide a value"
 read x
 for value in $( cat sercel_output2.3 )
 do
    if  [ "$x" = "$value" ]
       then
          echo " value $x found "
       else
           echo " value $ x not found "
    fi
 done
 grep "$x" sercel_output2.3 | wc -l 
  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    Southern Alberta Institue of Technology Calgary Alberta Canada
    Patricia Casto Advanced Linux

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

so, where you stuck ?

we are stuck on how to write the codes for
d) fiind the maximum value in the column(there is only one column in the file)
e) calculate the average of the column. ( I only have one point after the decimal)

any suggestions would be a big help

Thank you

 
max=0
for value in $( cat sercel_output2.3 )
do
 # check if $max is less than $value
 # if yes, then assign $max = $value
 # once this loop completed, $max will hold the maximum value
done
echo $max
 
sum=0
count=0
for value in $( cat sercel_output2.3 )
do
 # increment the count variable by 1 ( count = count + 1 )
 # sum = $sum + $value
done
# average  = $sum / $count

come with your own syntax, and let us know, if you need more help

@dstewie: Did you try searching the forum for similar questions? Help In fetching the 2nd Peak value of a column

But I would encourage you to come up with your own logic and code it.