Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Averaging 100 columns together line by line Post 302442165 by jenjen_mt on Tuesday 3rd of August 2010 12:19:08 PM
Old 08-03-2010
Averaging 100 columns together line by line

Hi

I have 100 xy graphs and need to average these together in a line by line fashion. The value of the x axis are the same. y differs e.g. taking only 2 graphs:

graph 1
Code:
x    y
1    3 
2    5
3    7 
4    9
5    11

graph 2
Code:
x    y
1    4
2    6
3    10 
4    12
5    15

The average graph which I need to calculate would be
Code:
x    y
1    3.5 
2    5.5
3    8.5 
4    10.5
5    13

in this format.
All the examples I have found using awk calculate the average of the entire column which isn't what I need
Can anyone point me in the right direction?

Thanks

Moderator's Comments:
Mod Comment Use code tags please, ty.

Last edited by zaxxon; 08-03-2010 at 01:37 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Averaging multiple columns

Hello, I am trying to average multiple columns simultaneously while skipping the first column. I am using this awk line to average one column awk '{sum+=$3} END { print "Average = ",sum/NR}' But I want to be able to do it for multiple columns while skipping the first column. There... (4 Replies)
Discussion started by: gisele_l
4 Replies

2. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

3. Shell Programming and Scripting

Averaging Data From Multiple Columns, Using Header if Possible

Hi, I have a file with multiple tab delimited columns and I would like to have the average of each column: Iteration Tree No Lh HMean 1000 1 -78.834717 -78.834717 1100 1 -77.991031 -78.624046 1200 1 -79.416055 -78.761861 1300 1 -79.280494 -78.968099 1400 1 -82.846275 -80.808696 ... (4 Replies)
Discussion started by: mikey11415
4 Replies

4. Shell Programming and Scripting

averaging columns

Hi, I have a file that has 201 columns (1 for the name of each row and the other 200 are values) I want to print the average for each column the file looks like this (as an example this only has 7 columns with values) 1 2 3 4 5 6 7 abr 5 6 7 1 2 4 5 hhr 2 1 3 4 ... (8 Replies)
Discussion started by: kylle345
8 Replies

5. Shell Programming and Scripting

how to read the contents of two files line by line and compare the line by line?

Hi All, I'm trying to figure out which are the trusted-ips and which are not using a script file.. I have a file named 'ip-list.txt' which contains some ip addresses and another file named 'trusted-ip-list.txt' which also contains some ip addresses. I want to read a line from... (4 Replies)
Discussion started by: mjavalkar
4 Replies

6. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

7. Shell Programming and Scripting

Need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line...

Hello, I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be: SRVXPAPI001 ERRO JUN24 07:28:34 1775 REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F ... (8 Replies)
Discussion started by: Ferocci
8 Replies

8. Shell Programming and Scripting

How to read file line by line and compare subset of 1st line with 2nd?

Hi all, I have a log file say Test.log that gets updated continuously and it has data in pipe separated format. A sample log file would look like: <date1>|<data1>|<url1>|<result1> <date2>|<data2>|<url2>|<result2> <date3>|<data3>|<url3>|<result3> <date4>|<data4>|<url4>|<result4> What I... (3 Replies)
Discussion started by: pat_pramod
3 Replies

9. Shell Programming and Scripting

Split multi columns line to 2 columns

I have data like this 1 a,b,c 2 a,c 3 b,d 4 e,f would like convert like this 1 a 1 b 1 c 2 a 2 c 3 b 3 d 4 e 4 f Please help me out (4 Replies)
Discussion started by: jhonnyrip
4 Replies

10. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
HOBBITGRAPH.CGI(1)					      General Commands Manual						HOBBITGRAPH.CGI(1)

NAME
hobbitgraph.cgi - CGI to generate Xymon trend graphs SYNOPSIS
hobbitgraph [options] DESCRIPTION
hobbitgraph.cgi is invoked as a CGI script via the hobbitgraph.sh CGI wrapper. hobbitgraph.cgi is passed a QUERY_STRING environment variable with the following parameters: host Name of the host to generate a graph for service Name of the service to generate a graph for disp Display-name of the host, used on the generated graphs instead of hostname. graph Can be "hourly", "daily", "weekly" or "monthly" to select the time period that the graph covers. first Used to split multi-graphs into multiple graphs. This causes hobbitgraph.cgi to generate only the graphs starting with the "first'th" graph and continuing for "count". count Number of graphs in a multi-graph. upper Set the upper limit of the graph. See rrdgraph(1) for a description of the "-u" option. lower Set the lower limit of the graph. See rrdgraph(1) for a description of the "-l" option. graph_start Set the starttime of the graph. This is used in zoom-mode. graph_end Set the end-time of the graph. This is used in zoom-mode. action=menu Generate an HTML page with links to 4 graphs, representing the hourly, weekly, monthly and yearly graphs. Doesn't actually gen- erate any graphs, only the HTML that links to the graphs. action=selzoom Generate an HTML page with link to single graph, and with JavaScript code that lets the user select part of the graph for a zoom-operation. The JavaScript invokes hobbitgraph.cgi with "action=showzoom" to generate the zoomed graph webpage. action=showzoom Generate HTML with a link to the zoomed graph image. This link goes to an "action=view" invocation of hobbitgraph.cgi. action=view Generate a single graph image. OPTIONS
--config=FILENAME Loads the graph configuration file from FILENAME. If not specified, the file $BBHOME/etc/hobbitgraph.cfg is used. See the hobbit- graph.cfg(5) for details about this file. --env=FILENAME Loads the environment settings defined in FILENAME before executing the CGI. --rrddir=DIRECTORY The top-level directory for the RRD files. If not specified, the directory given by the BBRRDS environment is used. --save=FILENAME Instead of returning the image via the CGI interface (i.e. on stdout), save the generated image to FILENAME. --debug Enable debugging output. ENVIRONMENT
QUERY_STRING Provided by the webserver CGI interface, this decides what graph to generate. FILES
hobbitgraph.cfg: The configuration file determining how graphs are generated from RRD files. SEE ALSO
hobbitgraph.cfg(5), xymon(7), rrdtool(1) Xymon Version 4.2.3: 4 Feb 2009 HOBBITGRAPH.CGI(1)
All times are GMT -4. The time now is 05:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy