12-09-2008
unix calculator
Hi,
I would like to know how can I calculate mean, median and standard deviation of some numbers in a file.
Example file:
a 102 abc
b 301 adc
c 222 adc
I would like to calculate the mean, median and standard deviation of the numbers in the 2nd column of the example file.
Thanks in advance
6 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have below awk statement and I need to convert the second field ( substr($0,8,6))from minutes to hours with 2 decimail place. How can I achieve this?
/usr/bin/awk '{print substr($0,23,4),substr($0,8,6)}' /tmp/MANAGER_LIST.$$ >> /tmp/NEWMANAGER_LIST.$$
Thanks for any help! (4 Replies)
Discussion started by: whatisthis
4 Replies
2. Shell Programming and Scripting
hi!
i have a file like the attachement.
you can see on the last column, there is a marker from 1 to 64 for each time.
I'd like to have the median for each marker: i want to get a median every 128 values
the result is : for an hour and marker x, i have the median value
thank you for... (5 Replies)
Discussion started by: riderman
5 Replies
3. Shell Programming and Scripting
Input file:
21.08
21.06
20.98
20.65
18.52
16.34
13.58
12.2
10.66
10.22
9.8
8.6
7.4
3.9
3.5
Desired output file: (10 Replies)
Discussion started by: perl_beginner
10 Replies
4. Shell Programming and Scripting
Is there a way in awk to compute the median of a set of numbers in a file in the following format.
34
67
78
100
23
45
67 (3 Replies)
Discussion started by: Lucky Ali
3 Replies
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
I use the following script to print the sum and how could I extend this to print medians instead? thanks
name s1 s2 s3 s4
g1 2 8 6 5
g1 5 7 9 9
g1 6 7 8 9
g2 8 8 8 8
g2 7 7 7 7
g2 10 10 10 10
g3 3 12 1 24
g3 5 5 24 48
g3 12 3 12 12
g3 2 3 3 3
output
name s1 s2 s3 s4
g1 5 7 8 9... (5 Replies)
Discussion started by: quincyjones
5 Replies
LEARN ABOUT DEBIAN
grdinfo
GRDINFO(l) GRDINFO(l)
NAME
grdinfo - Get information about the contents of a 2-D grd file
SYNOPSIS
grdinfo grdfiles [ -C ] [ -D ] [ -F ] [ -L1 ] [ -L2 ] [ -M ] [ -V ]
DESCRIPTION
grdinfo reads a 2-D binary grd file and reports various statistics for the (x,y,z) data in the grdfile. The output information contains the
minimum/maximum values for x, y, and z, where the min/max of z occur, the x- and y-increments, and the number of x and y nodes, and
[optionally] the mean, standard deviation, and/or the median, L1 scale of z, and number of nodes set to NaN.
grdfile
The name of one or several 2-D grd files.
OPTIONS
No space between the option flag and the associated arguments.
-C Formats the report using tab-separated fields on a single line. The output is w e s n z0 z1 dx dy nx ny [ x0 y0 x1 y1 ] [ med scale
] [ mean std rms] [n_nan]. The data in brackets are output only if the corresponding options -M, -L1, -L2, and -M are used, respec-
tively.
-D Report grid domain and x/y-increments using dd:mm:ss[.fff] notation [Default is decimal]. Does not apply to the -C option.
-F Report grid domain and x/y-increments world mapping format [Default is generic]. Does not apply to the -C option.
-L1 Report median and L1 scale of z (L1 scale = 1.4826 * Median Absolute Deviation (MAD)).
-L2 Report mean and standard deviation of z.
-M Find and report the location of min/max z-values, and count and report the number of nodes set to NaN, if any.
-V Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].
EXAMPLES
To obtain all the information about the data set in file hawaii_topo.grd, try
grdinfo -L1 -L2 -M hawaii_topo.grd
SEE ALSO
gmt(1gmt), grd2cpt(1gmt), grd2xyz(1gmt), grdedit(1gmt)
1 Jan 2004 GRDINFO(l)