9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Have a input file like this .....
attachments 100G
shared 1T
archive 300M
documents 300G
remotedocs 150M
I need the total in GB's ... where as M=MB,G=GB,T=TB
Basically need awk to calculate the total based on end... (5 Replies)
Discussion started by: greycells
5 Replies
2. Shell Programming and Scripting
I would like to calculate
1/n
In awk, I wrote the following line for the sigma summation:
{ summ+=($1-average)^2 }
Full code:
BEGIN { Print "This script calculate error estimates"; sum=0 }
{ sum+=$1; n++ }
END { average = sum/n }
BEGIN { summ=0 }
{ summ+=($1-average)^2 }
END { print... (8 Replies)
Discussion started by: chrisjorg
8 Replies
3. Shell Programming and Scripting
Hi all,
I am attempting to calculate a running variance for a file containing a column of numbers. I am using the formula variance=sum((x-mean(x))^2)/(n-1), where x is the value on the current row, and mean(x) is the average of all of the values up until that row. n represents the total number... (1 Reply)
Discussion started by: Jahn
1 Replies
4. Shell Programming and Scripting
Hi Everybody,
I have the following example file...
199|TST-GURGAON|GURGAON|1
199|TST-GURGAON|GURGAON|1
199|TST-GURGAON|GURGAON|1
199|TST-GURGAON|GURGAON|1
199|TST-GURGAON|GURGAON|1
199|TST-GURGAON|GURGAON|1
199|TST-GURGAON|GURGAON|1
199|TST-GURGAON|GURGAON|1
199|TST-GURGAON|GURGAON|1... (8 Replies)
Discussion started by: sraj142
8 Replies
5. Shell Programming and Scripting
Hi guys,
I can't find a solution to sum the h:m:s: columns.
28/05/2010 03h 29min 34seg ADSL TELEMAR
28/05/2010 12h 19min 21seg ADSL TELEMAR
29/05/2010 04h 20min 02seg ADSL TELEMAR
29/05/2010 04h 31min 45seg ADSL TELEMAR
30/05/2010 06h 10min 43seg ADSL TELEMAR
Thanks
Use code... (8 Replies)
Discussion started by: ashimada
8 Replies
6. Shell Programming and Scripting
hi all!
I have a space delimited file...
I would like to total column 3 on the condition that column 2 is less than 1030 to a variable in my script
something like this:
TOTAL="`awk '{$2 < 1030} {s+=$3}END{print s}' file`"
Seem to be ignoring the {$2 < 1030}, I'm not sure of the... (3 Replies)
Discussion started by: lyoncc
3 Replies
7. Shell Programming and Scripting
Good afternoon! Im new at scripting and Im trying to write a script to
calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies
8. Programming
Here I want to calculate mean,variance and sum from a file
1.1*2*4*22*211*22*12*22*22*11
2.2*2*22*12*22*11*11*122*33*22
3.9*7*22*88*87*98*67*66*56*66*11
As this is a large file and i am trying to write in c
where formulae of
MEAN = 1/N (X1...+..Xn)
Variance = square root of 1/N-1... (9 Replies)
Discussion started by: cdfd123
9 Replies
9. Shell Programming and Scripting
#!/usr/bin/perl -w
use strict;
open(FH,"$ARGV") or die;
my @temp=<FH>;
close FH;
my $mean = Mean(\@temp);
my $var = variance(\@temp);
print "$var\n";
sub estimate_variance {
my ($arrayref) = @_;
my ($mean,$result) = (mean($arrayref),0);
foreach (@$arrayref) {... (4 Replies)
Discussion started by: cdfd123
4 Replies