Sponsored Content
Top Forums Shell Programming and Scripting awk based script to find the average of all the columns in a data file Post 302697333 by jaelliot on Thursday 6th of September 2012 02:56:02 PM
Old 09-06-2012
need help

i have the following data

0 ORANGE 751 BLUE 885
1 RED 787 GOLD 892
2 ORANGE 298 BLUE 138
3 RED 395 GOLD 755
4 ORANGE 658 GOLD 880
5 RED 79 BLUE 323
6 RED 977 GOLD 410
7 RED 406 BLUE 10
8 RED 15 BLUE 269
9 ORANGE 696 BLUE 623
10 ORANGE 878 BLUE 606

AND i need help displaying it like this

Required Output
TOTAL: 11
# of Red: 6
# of Orange: 5
# of Blue: 7
# of Gold: 4
Avg. of Num A Column: 540.000000
Avg. of Num B Column: 526.454545

I came up with a awk code to help me find the avg of the number column in the terminal but the out put is not what i wont
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk based script to find the median of all individual columns in a data file

Hi All, I have some data like below. Step1,Param1,Param2,Param3 1,2,3,4 2,3,4,5 2,4,5,6 3,0,1,2 3,0,0,0 3,2,1,3 ........ so on Where I need to find the median(arithmetic) of each column from Param1...to..Param3 for each set of Step1 values. (Sort each specific column, if the... (5 Replies)
Discussion started by: ks_reddy
5 Replies

2. Shell Programming and Scripting

AWK script to split data and find average

Input: 2.58359023380340e+02 1.43758864405595e+02 -7.65700666212508e+00 1.06460208083228e+02 1.26185441783936e+02 -3.41389169427027e+01 -1.40393299309592e+02 -3.07758776849508e+01 1.45067703495838e+02 1.79405834959073e+02 5.06666234594205e+01 OUT 2.0105894389e+02 (average of... (8 Replies)
Discussion started by: chrisjorg
8 Replies

3. Shell Programming and Scripting

awk based script to ignore all columns from a file which contains character strings

Hello All, I have a .CSV file where I expect all numeric data in all the columns other than column headers. But sometimes I get the files (result of statistics computation by other persons) like below( sample data) SNO,Data1,Data2,Data3 1,2,3,4 2,3,4,SOME STRING 3,4,Inf,5 4,5,4,4 I... (9 Replies)
Discussion started by: ks_reddy
9 Replies

4. UNIX for Dummies Questions & Answers

Find the average based on similar names in the first column

I have a table, say this: name1 num1 num2 num3 num4 name2 num5 num6 num7 num8 name3 num1 num3 num4 num9 name2 num8 num9 num1 num2 name2 num4 num5 num6 num4 name4 num4 num5 num7 num8 name5 num1 num3 num9 num7 name5 num6 num8 num3 num4 I want a code that will sort my data according... (4 Replies)
Discussion started by: FelipeAd
4 Replies

5. Shell Programming and Scripting

awk script to split file into multiple files based on many columns

So I have a space delimited file that I'd like to split into multiple files based on multiple column values. This is what my data looks like 1bc9A02 1 10 1000 FTDLNLVQALRQFLWSFRLPGEAQKIDRMMEAFAQRYCQCNNGVFQSTDTCYVLSFAIIMLNTSLHNPNVKDKPTVERFIAMNRGINDGGDLPEELLRNLYESIKNEPFKIPELEHHHHHH 1ku1A02 1 10... (9 Replies)
Discussion started by: viored
9 Replies

6. Emergency UNIX and Linux Support

Average columns based on header name

Hi Friends, I have files with columns like this. This sample input below is partial. Please check below for main file link. Each file will have only two rows. ... (8 Replies)
Discussion started by: jacobs.smith
8 Replies

7. Shell Programming and Scripting

Average across multiple columns - awk

Hi forum members, I'm trying to get an average of multiple columns in a csv file using awk. A small example of my input data is as follows: cu,u3o8,au,ag -9,20,-9,3.6 0.005,30,-9,-9 0.005,50,10,3.44 0.021,-9,8,3.35 The following code seems to do most of what I want gawk -F","... (6 Replies)
Discussion started by: theflamingmoe
6 Replies

8. Shell Programming and Scripting

Find columns in a file based on header and print to new file

Hello, I have to fish out some specific columns from a file based on the header value. I have the list of columns I need in a different file. I thought I could read in the list of headers I need, # file with header names of required columns in required order headers_file=$2 # read contents... (11 Replies)
Discussion started by: LMHmedchem
11 Replies

9. Shell Programming and Scripting

awk script to find data in three file and perform replace operation

Have three files. Any other approach with regards to file concatenation or splitting, etc is appreciated If column55(billngtype) of file1 contains YMNC or YPBC then pick the value of column13(documentnumber). Now find this documentnumber in column1(Billdoc) of file2 and grep the corresponding... (4 Replies)
Discussion started by: as7951
4 Replies

10. UNIX for Advanced & Expert Users

Need Optimization shell/awk script to aggreagte (sum) for all the columns of Huge data file

Optimization shell/awk script to aggregate (sum) for all the columns of Huge data file File delimiter "|" Need to have Sum of all columns, with column number : aggregation (summation) for each column File not having the header Like below - Column 1 "Total Column 2 : "Total ... ...... (2 Replies)
Discussion started by: kartikirans
2 Replies
SPLASHY_CONFIG(1)					 Splashy POSIX boot splash system					 SPLASHY_CONFIG(1)

NAME
Splashy - a user-mode, POSIX and LSB compliant, boot splashing system for UNIX. SYNOPSIS
splashy_config [-h, --help] [-s, --set-theme THEME] [-i, --install-theme THEME.tar.gz] [-r, --remove-theme THEME][--info] [-c, --create-theme [args...]] DESCRIPTION
Splashy displays an image and a progress bar at boot time. splashy_config is used to change Splashy configuration options. OPTIONS
-h, --help Print helps and exits -s, --set-theme THEME Changes current theme to THEME -i, --install-theme THEME.tar.gz Adds THEME to Splashy theme directory -r, --remove-theme THEME Removes THEME from theme directory --info Prints all relevant information from the main Splashy config file -c, --create-theme [args...] Create a theme in an interactive mode if no arguments, else see the extra arguments section below Extra arguments --name NAME Set the NAME of the new Splashy theme --version VERSION Set the VERSION of the new Splashy theme --description DESC Set the DESC of the new Splashy theme --urls URLs Set the related URLs for this theme --author AUTHOR Set the AUTHOR(s) of the new Splashy theme --boot-image PATH Upload the boot image located at the specified PATH --shutdown-image PATH Upload the shutdown image located at the specified PATH --error-image PATH Upload the error image located at the specified PATH --resume-image PATH Upload the resume image located at the specified PATH --suspend-image PATH Upload the suspend image located at the specified PATH --background-width WIDTH Set the WIDTH of the background --background-height HEIGHT Set the HEIGHT of the background --progressbar-x X-POSITION Set the X-POSITION of the progress bar (percentage if the background height and width are not set, else pixel units) --progressbar-y Y-POSITION Set the Y-POSITION of the progress bar (percentage if the background height and width are not set, else pixel units) --progressbar-width WIDTH Set the WIDTH of the progress bar (percentage if the background height and width are not set, else pixel units) --progressbar-height HEIGHT Set the HEIGHT of the progress bar (percentage if the background height and width are not set, else pixel units) --progressbar-red RED Set the RED channel of the progress bar (0->255) --progressbar-green GREEN Set the GREEN channel of the progress bar (0->255) --progressbar-blue BLUE Set the BLUE channel of the progress bar (0->255) --progressbar-alpha ALPHA Set the ALPHA channel of the progress bar (0->255) --progressbar-border-show yes|no Set a border around the progressbar --progressbar-border-red RED Set the RED channel of the border around the progressbar (0->255) --progressbar-border-green GREEN Set the GREEN channel of the border around the progressbar (0->255) --progressbar-border-blue BLUE Set the BLUE channel of the border around the progressbar (0->255) --progressbar-border-alpha ALPHA Set the ALPHA channel of the border around the progressbar (0->255) --progressbar-background-red RED Set the RED channel of the background of the progressbar (0->255) --progressbar-background-green GREEN Set the GREEN channel of the background of the progressbar (0->255) --progressbar-background-blue BLUE Set the BLUE channel of the background of the progressbar (0->255) --progressbar-background-alpha ALPHA Set the ALPHA channel of the background of the progressbar (0->255) --textbox-show yes|no Set a text box --textbox-x X-POS Set the X-POS of the text box (percentage if the background height and width are not set, else pixel units) --textbox-y Y-POS Set the Y-POS of the text box (percentage if the background height and width are not set, else pixel units) --textbox-width WIDTH Set the WIDTH of the text box (percentage if the background height and width are not set, else pixel units) --textbox-height HEIGHT Set the HEIGHT of the text area (percentage if the background height and width are not set, else pixel units) --textbox-red RED Set the RED channel of the text area (0->255) --textbox-green GREEN Set the GREEN channel of the text area (0->255) --textbox-blue BLUE Set the BLUE channel of the text area (0->255) --textbox-alpha ALPHA Set the ALPHA channel of the text area (0->255) --textbox-border-show yes|no Set a border around the text area --textbox-border-red RED Set the RED channel of the border of the text area (0->255) --textbox-border-green GREEN Set the GREEN channel of the border of the text area (0->255) --textbox-border-blue BLUE Set the BLUE channel of the border of the text area (0->255) --textbox-border-alpha ALPHA Set the ALPHA channel of the border of the text area (0->255) --text-font-file FILE Upload the FONT file --text-font-height HEIGHT Set the HEIGHT of the text area font --text-font-red RED Set the RED channel of the text area font (0->255) --text-font-green GREEN Set the GREEN channel of the text area font (0->255) --text-font-blue BLUE Set the BLUE channel of the text area font (0->255) --text-font-alpha ALPHA Set the ALPHA channel of the text area font (0->255) --autoverbose yes|no Set if Splashy turn into verbose mode when an error appears at boot --progressbar-visibility-boot yes|no Set if Splashy shows a progress bar on boot --progressbar-visibility-shutdown yes|no Set if Splashy shows a progress bar on shutdown --progressbar-visibility-resume yes|no Set if Splashy shows a progress bar on resume --progressbar-visibility-suspend yes|no Set if Splashy shows a progress bar on suspend --progressbar-direction-boot forward|backward Set if the progress bar goes forward or backward on boot --progressbar-direction-shutdown forward|backward Set if the progress bar goes forward or backward on shutdown --progressbar-direction-resume forward|backward Set if the progress bar goes forward or backward on resume --progressbar-direction-suspend forward|backward Set if the progress bar goes forward or backward on suspend --fadein yes|no Set if Splashy appears smoothly --fadeout yes|no Set if Splashy disappears smoothly EXAMPLES
"/usr/bin/splashy_config --info" Shows all the themes currently installed. FILES
/etc/splashy/config.xml Main configuration. defines how splashy should be setup. /etc/splashy/themes/default/theme.xml Default theme. defines how the images displayed by splashy should be setup, their location and other theme-related variables. SEE ALSO
splashy(1), splashy_update(1), splashy-config.xml(5), splashy-theme.xml(5) AUTHORS
Vincent Amouret <vincent.amouret@gmail.com> Luis Mondesi <lemsx1@gmail.com> perl v5.12.1 2010-07-05 SPLASHY_CONFIG(1)
All times are GMT -4. The time now is 08:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy