Re: Bourne Shell Script Newbie Help

From: Chris F.A. Johnson (c.fa.johnson_at_rogers.com)
Date: 01/14/04


Date: 14 Jan 2004 20:01:28 GMT

On Wed, 14 Jan 2004 at 19:24 GMT, Daz wrote:
> Hello Group, I need some assistance in starting an assignment. I have
> never programmed in Unix let alone shell scripting. I searched the
> internet to find similar problems to mine when I came accross this. So
> could you aid me in starting this problem. Thank you. Heres the
> problem:
>
> Overview
>
> In this assignment you will write a Bourne shell script to calculate
> averages and medians from an input file of numbers. This is the
> sort of calculation I might do when figuring out the grades for this
> course. The input file will have whole number values separated by
> tabs, and each line of this file will have the same number of
> values. (For example, each row might be the scores of a student on
> assignments.) Your script should be able to calculate the average
> and median across the rows (like I might do to calculate an
> individual student's course grade) or down the columns (like I might
> do to find the average score on an assignment).

    What you are asking for is the course that your instructor should
    be teaching.

    If you want help here, make an attempt (i.e. read the material
    mentioned in the assignment, break the task into its component
    parts, code each part) and post your code here when you have
    problems.

    For example, learn how to do this before tackling other parts of
    the script:

> All values and results are whole numbers. You will use the expr
> command to do your calculations; it only works with whole numbers.
> When you calculate the average you should round to nearest whole
> number. (How do you do that with only whole number operations?)

-- 
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2004, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License


Relevant Pages

  • Re: Howto construct a message for a simple WebService call?
    ... A very good answer, but still, I would like to see sample code to that ... >> to use the construct message shape to transform the input FILE to a web ... > When BizTalk imports a WSDL, it will create Multi-part message types for the ... > Assignment shape. ...
    (microsoft.public.biztalk.general)
  • Re: Bourne Shell Script Newbie Help
    ... I need some assistance in starting an assignment. ... > use top-down refinement to get it down to a fairly low level of detailed ... > textual instructions, then read the course notes to see how to perform ... For example the input file looks like this: ...
    (comp.unix.shell)
  • Re: can anyone see the error in this script please I am BASHing my head LOL
    ... do # For as many lines as the input file has... ... Do not precede a variable with '$' on the left-hand side of an assignment. ... echo theLine>> testoutput.txt ...
    (comp.unix.shell)