Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

awk question

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 02-25-2016   -   Original Discussion by geekmonster
geekmonster's Unix or Linux Image
geekmonster geekmonster is offline
Registered User
Join Date: Feb 2016
Last Activity: 25 February 2016, 5:23 PM EST
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
awk question

I have a data set that has 9 columns (Name, Type, Score).
here's a sample name=name, Type = Q(for quiz) - E(for exams) - H(for Homework) - F(for final), Score = 90.
I can easily add up all my scores then divide them for average or mean (total/n). How do I assign the value to corresponding letter in an Array


Name   Type   Score   Type   Score   Type   Score   Type   Score
Jones     Q        90       H        100     E        74        F        75
Bob          q         80      H        70       e        88        f        77

if I want to ad all the digits after Q (like 90 and 80) to get the average, how would I throw them in an array to get the mean?

Last edited by Don Cragun; 02-25-2016 at 08:58 PM.. Reason: Add CODE tags.
Sponsored Links
Old Unix and Linux 02-25-2016   -   Original Discussion by geekmonster
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Join Date: Jul 2012
Last Activity: 21 January 2018, 5:13 AM EST
Location: San Jose, CA, USA
Posts: 10,928
Thanks: 611
Thanked 3,819 Times in 3,263 Posts
Is this a homework assignment? Homework and coursework questions can only be posted in the Homework & Coursework forum following the requirements specified in the special homework rules.

If you did post homework in the main forums, please review the guidelines for posting homework and repost in the correct sub-forum and include a completely filled out homework template. Otherwise, please explain what real problem you are trying to solve here.

Show us what code you have tried to solve your problem (in CODE tags) and show us the output you are trying to produce (also in CODE tags) from the sample input you have provided.
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk question : system output to awk variable. rveri Shell Programming and Scripting 5 04-23-2013 02:29 AM
question about awk JA50 Shell Programming and Scripting 4 04-25-2012 12:12 PM
Basic awk question...getting awk to act on $1 of the command itself JasonHamm UNIX for Dummies Questions & Answers 2 04-02-2009 09:52 AM
awk question james94538 UNIX for Dummies Questions & Answers 3 02-27-2008 06:33 AM
awk .. question? moxxx68 Shell Programming and Scripting 2 12-28-2004 06:40 PM

All times are GMT -4. The time now is 06:50 AM.