Show Password


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

👤 Login to reply

Thread Tools Search this Thread Display Modes
Old 02-25-2016
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 07:58 PM.. Reason: Add CODE tags.
Sponsored Links
Old 02-25-2016
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Join Date: Jul 2012
Last Activity: 16 July 2018, 1:02 AM EDT
Location: San Jose, CA, USA
Posts: 11,406
Thanks: 649
Thanked 3,970 Times in 3,393 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
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:29 AM
question about awk JA50 Shell Programming and Scripting 4 04-25-2012 11:12 AM
Basic awk question...getting awk to act on $1 of the command itself JasonHamm UNIX for Dummies Questions & Answers 2 04-02-2009 08:52 AM
awk question james94538 UNIX for Dummies Questions & Answers 3 02-27-2008 05:33 AM
awk .. question? moxxx68 Shell Programming and Scripting 2 12-28-2004 05:40 PM

All times are GMT -4. The time now is 03:55 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.