07-08-2010
Please explain your math
Quote:
i would like to sum $2, $3 (marks) and divide each entry in $2 and $3 with their respective sums and print for each student as $4 and $5.
Huh?
Student 1
S1, a, b
S2, c, d
S3, e, f
What are you trying to do?
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file which is having 3 columns as (string string integer)
a b 1
x y 2
p k 5
y y 4
.....
.....
Question:
I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
Discussion started by: amigarus
6 Replies
2. Shell Programming and Scripting
Hi,
I am unable sum of each column in the loop usng awk command.
Awk is not allowing the parameters in the command.
i am facing the below error.
awk: 0602-562 Field $() is not correct.
Source file
abc.txt
100,200,300,400,500,600,700,800,900
101,201,301,401,501,601,701,801,901
... (1 Reply)
Discussion started by: number10
1 Replies
3. UNIX for Dummies Questions & Answers
I am trying to get the sum of the first column of a file. When I use the same method for other files it works just fine... for some reason for the file below it gives me an error that I don't understand... I tried looking at different lines of the file and tried different things, but I still... (7 Replies)
Discussion started by: cosmologist
7 Replies
4. Shell Programming and Scripting
// AIX 5.3 & AIX 6.1
ls -al |awk '{print $5}'
This gives each file's size in byte.
I need to get:
- the sum of all files in Giga bytes with loop.
- excluding the size of directories (ls -al returns the size of directories).
There are hundreds and thousands of files, so summing up... (8 Replies)
Discussion started by: Daniel Gate
8 Replies
5. Shell Programming and Scripting
Coins.txt:
gold 1 1986 USA American Eagle
gold 1 1908 Austria-Hungary Franz Josef 100 Korona
silver 10 1981 USA ingot
gold 1 1984 Switzerland ingot
gold 1 1979 RSA Krugerrand
gold 0.5 1981 RSA Krugerrand
gold 0.1 1986 PRC Panda
silver 1 1986 USA Liberty dollar
gold 0.25 1986 USA Liberty... (2 Replies)
Discussion started by: Ramesh M
2 Replies
6. Shell Programming and Scripting
I have the input file in attached.
I want the output file :
Date , Time , Max_Bearer
11/01/2013 , 23:00 , 1447.894167
11/02/2013 , 00:00 , 1429.266667
11/03/2013 , 00:00 , 712.3175
11/04/2013 , 22:00 , 650.9533333
11/05/2013 , 23:00 , 665.9558333
11/06/2013 , 23:00 , 659.8616667... (2 Replies)
Discussion started by: justbow
2 Replies
7. Shell Programming and Scripting
hi Gurus,
I have an extract as seen below:
INPUT
2015-08-24 15:00:00.0 |TCSERVER01 |ServiceEventHandler |2283
2015-08-24 15:01:00.0 |TCSERVER01 |ServiceEventHandler |576
2015-08-24 15:02:00.0 |TCSERVER01 |ServiceEventHandler |833
2015-08-24 15:03:00.0 |TCSERVER01 |ServiceEventHandler... (6 Replies)
Discussion started by: reignangel2003
6 Replies
8. Shell Programming and Scripting
Hi
I have attached txt file as input,
and i'm able to calculate sum of columns at the end but the format of sum is not coming up right.
awk -F"," '{for (i=4;i<=NF;i++) sum+=$i}{print}; END { sum="Total:"; for (i=1;i<=NF;i++) {printf sum ","} print "\n"}' input.txt
check the o/p file, at... (6 Replies)
Discussion started by: manas_ranjan
6 Replies
9. Shell Programming and Scripting
Hi,
I have an awk command that I am using, and part of it sums COL_9 however when I read the output it is not including decimal places;
awk '
BEGIN{FS=OFS=","}
NR==1{print;next}
{a+=$9
c = $12
d = $18
}
END{for(i in a) {split(i,b,";"); print $1, $2, $3, b, $5, $6, b, b, a, $10, $11,... (1 Reply)
Discussion started by: Ads89
1 Replies
LEARN ABOUT DEBIAN
maphimbu
MAPHIMBU(1) User Commands MAPHIMBU(1)
NAME
maphimbu - histogram builder for 1-d numerical and text data
SYNOPSIS
maphimbu [OPTION]... [FILE]
DESCRIPTION
This program produces 1-d histograms from numerical or text data input. It can be also used to estimate the probability distribution func-
tion of a numerical variable - see http://en.wikipedia.org/wiki/Probability_density_function.
OPTIONS
-x <int>
x-data column (default is 1)
-y <int>
y-data column (default is 2); It is considered only when combined with '-m' or '-S'
-d <float|int>
delta size (dx-resolution) in case of numerical data; Keep in mind that 2 is not the same as 2.0: in the first case the numbers are
treated as integers, in the latter as floats.
-n normalize the result A) non-numerical data: n(x) = counts(x)/sum_of_counts B) numerical data: the normalized probability density
func.
is P(-INF < x <INF) = Int_[-INF:INF] P(x)*dx = 1 ; For the numerical integration an open x-data interval is assumed.
-N normalize data against the total sum of counts (same as option '-n' with case A forced)
-U normalize the result with x-range mapped to unit; The x-values are mapped to the interval [0:1], respectively Int_[0:1] P(x)*dx = 1;
This option is mutually exclusive with '-n'.
-S compute sums and normalized sums of y-values; The total sum of all y-values is used for the normalization.
-m compute the arithmetic mean of y-values in the respective x-bar
-s <int>
sort output using the specified column; Header is skipped in this case.
-g <int>
sort output numerically using the specified column; Header is skipped in this case.
-r do reverse sorting (in combination with '-g' and '-s')
-C center histogram bars (shifts x-axis by 0.5*dx)
-X treat hole line as one string (single data record)
-H print a data description header
-V print program version and exit
--version
output version and copyright information
--help display help
-h display short help (options summary)
Note: this program is not intended for use in high order numerical computations.
REPORTING BUGS
Report bugs to <gnu@mirendom.net>
COPYRIGHT
Copyright (C) 2003-2007, 2009, 2011 Dimitar Ivanov
License: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
maphimbu 2.8.4 February 2012 MAPHIMBU(1)