11-13-2012
thanks sky, but issue is I can't use perl, can I same suggestion in awk or something like that...
as well as O/p doesn't align with the requested o/p, total var sum for 2nd date 9 Nov is not summed up as well as some columns for 09th nov are missing
Last edited by manas_ranjan; 11-13-2012 at 07:59 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file file like this. I want to sum all column 1 values.
input
A 2
A 3
A 4
B 4
B 2
Out put
A 9
B 6 (3 Replies)
Discussion started by: suresh3566
3 Replies
2. Shell Programming and Scripting
Dear All,
I want to get help for below case.
I have a file like this.
saman 1
gihan 2
saman 4
ravi 1
ravi 2
so i want to get the result,
saman 5
gihan 2
ravi 3 like this.
Pls help me. (17 Replies)
Discussion started by: Nayanajith
17 Replies
3. 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
4. Shell Programming and Scripting
Hello All ,
I have a problem with summing of column by group
Input File -
COL_1,COL_2,COL_3,COL_4,COL_5,COL_6,COL_7,COL_8,COL_9,COL_10,COL_11
3010,21,1923D ,6,0,0.26,0,0.26,-0.26,1,200807
3010,21,192BI ,6,24558.97,1943.94,0,1943.94,22615.03,1,200807
3010,21,192BI... (8 Replies)
Discussion started by: jambesh
8 Replies
5. Shell Programming and Scripting
I have a file in the following layout:
201008005946873001846130058030701006131840000000000000000000
201008006784994001154259058033001009527844000000000000000000
201008007323067002418095058034801002418095000000000000000000
201008007697126001722141058029101002214158000000000000000000... (2 Replies)
Discussion started by: jclanc8
2 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I am new to Linux environment , I working on Linux script which should send auto email based on the specific condition from log file. Below is the sample log file
Name m/c usage
abc xxx 10
abc xxx 20
abc xxx 5
xyz ... (6 Replies)
Discussion started by: asjaiswal
6 Replies
7. Shell Programming and Scripting
Hi,
I have a table to be imported for R as matrix or data.frame but I first need to edit it because I've got several lines with the same identifier (1st column), so I want to sum the each column (2nd -nth) of each identifier (1st column)
The input is for example, after sorted:
K00001 1 1 4 3... (8 Replies)
Discussion started by: sargotrons
8 Replies
8. Shell Programming and Scripting
this is part of a KT i am going thru.
i am writing a script in bash shell, linux where i have 2 columns where 1st signifies the nth hour like 00, 01, 02...23 and 2nd the file size.
sample data attached.
Desired output is 3 columns which will give the nth hour, number of entries in nth hour and... (3 Replies)
Discussion started by: alpha_1
3 Replies
9. UNIX for Dummies Questions & Answers
Hi All,
I have a requirement where I need to find sum of values from column D through O present in a CSV file and check whether the sum of each Individual column matches with the value present for that corresponding column present in the trailer record.
For example, let's assume for column D... (9 Replies)
Discussion started by: tpk
9 Replies
10. UNIX for Beginners Questions & Answers
I have a file which need to be summed up using date column.
I/P:
2017/01/01 a 10
2017/01/01 b 20
2017/01/01 c 40
2017/01/01 a 60
2017/01/01 b 50
2017/01/01 c 40
2017/01/01 a 20
2017/01/01 b 30
2017/01/01 c 40
2017/02/01 a 10
2017/02/01 b 20
2017/02/01 c 30
2017/02/01 a 10... (6 Replies)
Discussion started by: Booo
6 Replies
TOTAL(1) General Commands Manual TOTAL(1)
NAME
total - sum up columns
SYNOPSIS
total [ -m ][ -sE | -p | -u | -l ][ -i{f|d}[N] ][ -o{f|d} ][ -tC ][ -N [ -r ]] [ file .. ]
DESCRIPTION
Total sums up columns of real numbers from one or more files and prints out the result on its standard output.
By default, total computes the straigt sum of each input column, but multiplication can be specified instead with the -p option. Likewise,
the -u option means find the upper limit (maximum), and -l means find the lower limit (minimum).
Sums of powers can be computed by giving an exponent with the -s option. (Note that there is no space between the -s and the exponent.)
This exponent can be any real number, positive or negative. The absolute value of the input is always taken before the power is computed
in order to avoid complex results. Thus, -s1 will produce a sum of absolute values. The default power (zero) is interpreted as a straight
sum without taking absolute values.
The -m option can be used to compute the mean rather than the total. For sums, the arithmetic mean is computed. For products, the geomet-
ric mean is computed. (A logarithmic sum of absolute values is used to avoid overflow, and zero values are silently ignored.)
If the input data is binary, the -id or -if option may be given for 64-bit double or 32-bit float values, respectively. Either option may
be followed immediately by an optional count, which defaults to 1, indicating the number of double or float binary values to read per
record on the input file. (There can be no space between the option and this count.) Similarly, the -od and -of options specify binary
double or float output, respectively. These options do not need a count, as this will be determined by the number of input channels.
A count can be given as the number of lines to read before computing a result. Normally, total reads each file to its end before producing
its result, but this behavior may be overridden by inserting blank lines in the input. For each blank input line, total produces a result
as if the end-of-file had been reached. If two blank lines immediately follow each other, total closes the file and proceeds to the next
one (after reporting the result). The -N option (where N is a decimal integer) tells total to produce a result and reset the calculation
after every N input lines. In addition, the -r option can be specified to override reinitialization and thus give a running total every N
lines (or every blank line). If the end of file is reached, the current total is printed and the calculation is reset before the next file
(with or without the -r option).
The -tC option can be used to specify the input and output tab character. The default tab character is TAB.
If no files are given, the standard input is read.
EXAMPLE
To compute the RMS value of colon-separated columns in a file:
total -t: -m -s2 input
To produce a running product of values from a file:
total -p -1 -r input
BUGS
If the input files have varying numbers of columns, mean values will certainly be off. Total will ignore missing column entries if the tab
separator is a non-white character, but cannot tell where a missing column should have been if the tab character is white.
AUTHOR
Greg Ward
SEE ALSO
cnt(1), neaten(1), rcalc(1), rlam(1), tabfunc(1)
RADIANCE
2/3/95 TOTAL(1)