Calculate average of rows between two specific patterns
Hi,
I have a file like this:
I want to calculate the average of the 2nd column for each segment separately delimited by "variableStep chrom=chrX span=1". The row numbers between two "variableStep chrom=chrX span=1" are variable for each segment.
I tried this:
It is not giving me wrong output.
My desired output is:
for all segments
Thanks for help!
Last edited by jim mcnamara; 06-12-2013 at 01:21 PM..
Hi I have fakebook.csv as following:
F1(current date) F2(popularity) F3(name of book) F4(release date of book)
2006-06-21,6860,"Harry Potter",2006-12-31
2006-06-22,,"Harry Potter",2006-12-31
2006-06-23,7120,"Harry Potter",2006-12-31
2006-06-24,,"Harry Potter",2006-12-31... (0 Replies)
I have a file which is
2
3
4
5
6
6
so i am writing program in C to calculate mean..
#include<stdio.h>
#include<string.h>
#include <math.h>
double CALL mean(int n , double x)
main (int argc, char **argv)
{
char Buf,SEQ;
int i;
double result = 0;
FILE *fp; (3 Replies)
I want to calculate the average line by line of some files with several lines on them, the files are identical, just want to average the 3rd columns of those files.:wall:
Example file:
File 1
001 0.046 0.667267
001 0.047 0.672028
001 0.048 0.656025
001 0.049 ... (2 Replies)
Dear Gurus,
I have tab-delimited text files with matrix containing values. The first column is a identifier and other columns have the corresponding values. I would like to calculate the average value (total number/number of entries) for all entries from 2nd column to the last column in row... (3 Replies)
I have an awk script that gives the following output:
Average end-to-end transmission delay 2.7 to 5.7 is 0.635392 seconds
Average end-to-end transmission delay 2.1 to 5.1 is 0.66272 seconds
Average end-to-end transmission delay 2.1 to 5.1 is 0.691712 seconds
Average end-to-end transmission... (4 Replies)
Hello dears,
I have a log file with records like below and want to get a average of one column based on the search of one specific keyword.
2015-02-07 08:15:28 10.102.51.100 10.112.55.101 "kevin.c" POST ... (2 Replies)
Gents,
Please i will to get the distance and azimut from 2 coordinates:
Usig excel formula i get the correct values, but i will like to do it using awk.
Example
A 35089.0 50345.016 9 75 1 2101774 77 70 79 483911.6 2380106.9 137.4 1 1 6 1
A 35089.0 50345.01620 75... (8 Replies)
My old school way is a one liner. And will search for average from SAR, to get the data receive rate. But, I dont think it is practical or accurate,. Because it calculates to off peak hours. I am planning to change it. My cron runs every 30 mins. When my cron runs, and my time is 14:47pm,, it will... (1 Reply)
Discussion started by: invinzin21
1 Replies
LEARN ABOUT XFREE86
snmpdelta
SNMPDELTA(1) Net-SNMP SNMPDELTA(1)NAME
snmpdelta - Monitor delta differences in SNMP Counter values
SYNOPSIS
snmpdelta [ common options ] [-Cf] [ -Ct ] [ -Cs ] [ -CS ] [ -Cm ] [ -CF configfile ] [ -Cl ] [ -Cp period ] [ -CP Peaks ] [ -Ck ] [ -CT ]
AGENT OID [ OID ... ]
DESCRIPTION
snmpdelta will monitor the specified integer valued OIDs, and report changes over time.
AGENT identifies a target SNMP agent, which is instrumented to monitor the given objects. At its simplest, the AGENT specification will
consist of a hostname or an IPv4 address. In this situation, the command will attempt communication with the agent, using UDP/IPv4 to port
161 of the given target host. See snmpcmd(1) for a full list of the possible formats for AGENT.
OID is an object identifier which uniquely identifies the object type within a MIB. Multiple OIDs can be specified on a single snmpdelta
command.
OPTIONS
COMMON OPTIONS
Please see snmpcmd(1) for a list of possible values for COMMON OPTIONS as well as their descriptions.
-Cf Don't fix errors and retry the request. Without this option, if multiple oids have been specified for a single request and if the
request for one or more of the oids fails, snmpdelta will retry the request so that data for oids apart from the ones that failed
will still be returned. Specifying -Cf tells snmpdelta not to retry a request, even if there are multiple oids specified.
-Ct Flag will determine time interval from the monitored entity.
-Cs Flag will display a timestamp.
-CS Generates a "sum count" in addition to the individual instance counts. The "sum count" is the total of all the individual deltas
for each time period.
-Cm Prints the max value ever attained.
-CF configfile
Tells snmpdelta to read it's configuration from the specified file. This options allows the input to be set up in advance rather
than having to be specified on the command line.
-Cl Tells snmpdelta to write it's configuration to files whose names correspond to the MIB instances monitored. For example, snmpdelta
-Cl localhost ifInOctets.1 will create a file "localhost-ifInOctets.1".
-Cp Specifies the number of seconds between polling periods. Polling constitutes sending a request to the agent. The default polling
period is one second.
-CP peaks
Specifies the reporting period in number of polling periods. If this option is specified, snmpdelta polls the agent peaks number
of times before reporting the results. The result reported includes the average value over the reporting period. In addition, the
highest polled value within the reporting period is shown.
-Ck When the polling period (-Cp) is an increment of 60 seconds and the timestamp is displayed in the output (-Cs), then the default
display shows the timestamp in the format hh:mm mm/dd. This option causes the timestamp format to be hh:mm:ss mm/dd.
-CT Makes snmpdelta print its output in tabular form.
-Cv vars/pkt
Specifies the maximum number of oids allowed to be packaged in a single PDU. Multiple PDUs can be created in a single request. The
default value of variables per packet is 60. This option is useful if a request response results in an error becaues the packet is
too big.
EXAMPLES
$ snmpdelta -c public -v 1 -Cs localhost IF-MIB::ifInUcastPkts.3 IF-MIB::ifOutUcastPkts.3
[20:15:43 6/14] ifInUcastPkts.3 /1 sec: 158
[20:15:43 6/14] ifOutUcastPkts.3 /1 sec: 158
[20:15:44 6/14] ifInUcastPkts.3 /1 sec: 184
[20:15:44 6/14] ifOutUcastPkts.3 /1 sec: 184
[20:15:45 6/14] ifInUcastPkts.3 /1 sec: 184
[20:15:45 6/14] ifOutUcastPkts.3 /1 sec: 184
[20:15:46 6/14] ifInUcastPkts.3 /1 sec: 158
[20:15:46 6/14] ifOutUcastPkts.3 /1 sec: 158
[20:15:47 6/14] ifInUcastPkts.3 /1 sec: 184
[20:15:47 6/14] ifOutUcastPkts.3 /1 sec: 184
[20:15:48 6/14] ifInUcastPkts.3 /1 sec: 184
[20:15:48 6/14] ifOutUcastPkts.3 /1 sec: 184
[20:15:49 6/14] ifInUcastPkts.3 /1 sec: 158
[20:15:49 6/14] ifOutUcastPkts.3 /1 sec: 158
^C
$ snmpdelta -c public -v 1 -Cs -CT localhost IF-MIB:ifInUcastPkts.3 IF-MIB:ifOutcastPkts.3
localhost ifInUcastPkts.3 ifOutUcastPkts.3
[20:15:59 6/14] 184.00 184.00
[20:16:00 6/14] 158.00 158.00
[20:16:01 6/14] 184.00 184.00
[20:16:02 6/14] 184.00 184.00
[20:16:03 6/14] 158.00 158.00
[20:16:04 6/14] 184.00 184.00
[20:16:05 6/14] 184.00 184.00
[20:16:06 6/14] 158.00 158.00
^C
The following example uses a number of options. Since the Cl option is specified, the output is sent to a file and not to the screen.
$ snmpdelta -c public -v 1 -Ct -Cs -CS -Cm -Cl -Cp 60 -CP 60
interlink.sw.net.cmu.edu .1.3.6.1.2.1.2.2.1.16.3 .1.3.6.1.2.1.2.2.1.16.4
fi
SEE ALSO snmpcmd(1), variables(5).
4th Berkeley Distribution 25 Jul 2003 SNMPDELTA(1)