Hi,
i want to sum all nubers in one column. Example:
12.23
11
23.01
3544.01
I'm trying to do this in awk, but it doesn't work properly.
Seems like awk is summing only integers, for example:
12
11
23
3544
It cuts off numbers after dot.
I used this command:
akw /text/ file.txt |nawk... (1 Reply)
hello im looking for short way to sum numbers from stdout the way i found to do it is to long for me i wander if there is shorter way to do it
ok it 2 stage action
this will make the list of number in to file sum.txt
grep -c include *.c | awk '{l=split($0,a,":");print a;}' > sum.txt
this... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Shell script to find sum of first n numbers of Fibonacci series
2. Relevant commands, code, scripts,... (0 Replies)
cat *.out |grep "<some text>" | awk '{print $6}'
For ex,This will reutrn me
11111
22222
is it possible to add these two numbers in the above given command itself?I can write this to a file and find the sum.
But I prefer to this calculation in the above given line itself.
Any... (3 Replies)
I basically have a file where I had to do a bunch of greps to get a list of numbers
example: a file called numbers.txt
10000
10000
superman
10000
batman
10000
10000
grep '100' * |
10000
10000
10000
10000
10000 (2 Replies)
Hi all;
Here is my file:
V1.3=4
V1.4=5
V1.1=3
V1.2=6
V1.3=6
Please, can you help me to write a script shell that counts the sum of values in my file (4+5+3+6+6) ?
Thank you so much for help.
Kind regards. (3 Replies)
I want to count the number of lines, I need this result be a number, and sum the last numeric column, I had done to make this one at time, but I need to make this for a crontab, so, it has to be an script, here is my lines:
It counts the number of lines:
egrep -i String file_name_201611* |... (5 Replies)
I need help with this assignment. I'm very new to using UNIX/LINUX, and my only previous experience with programing anything is using python.
We are writing scripts using vim, and this one I'm stumped on.
"Write a shell script that finds and display the sum of even positive integers from 0 to... (5 Replies)
Discussion started by: Nastybutler
5 Replies
LEARN ABOUT CENTOS
mail::spamassassin::util::progress
Mail::SpamAssassin::Util::Progress(3) User Contributed Perl Documentation Mail::SpamAssassin::Util::Progress(3)NAME
Mail::SpamAssassin::Util::Progress - Progress bar support for SpamAssassin
SYNOPSIS
my $progress = Mail::SpamAssassin::Util::Progress->new({total => 100});
$msgcount = 0;
foreach my $message (@messages) {
# do something here
$msgcount++;
$progress->update($msgcount);
}
$progress->final();
DESCRIPTION
This module implements a progress bar for use in SpamAssassin scripts and modules. It allows you to create the progress bar, update it and
print out the final results of a particular run.
new
public class (Mail::SpamAssassin::Util::Progress) new (\% $args)
Description: Creates a new Mail::SpamAssassin::Util::Progress object, valid values for the $args hashref are:
total (required)
The total number of messages expected to be processed. This item is required.
fh [optional]
An optional filehandle may be passed in, otherwise STDERR will be used by default.
term [optional]
The module will attempt to determine if a valid terminal exists on the STDIN filehandle. This item allows you to override that value.
init_bar
public instance () init_bar()
Description: This method creates the initial progress bar and is called automatically from new. In addition you can call init_bar on an
existing object to reset the bar to it's original state.
update
public instance () update ([Integer $num_done])
Description: This method is what gets called to update the progress bar. You may optionally pass in an integer value that indicates how
many messages have been processed. If you do not pass anything in then the num_done value will be incremented by one.
final
public instance () final ([Integer $num_done])
Description: This method should be called once all processing has finished. It will print out the final msgs per sec calculation and the
total time taken. You can optionally pass in a num_done value, otherwise it will use the value calculated from the last call to update.
perl v5.16.3 2011-06-06 Mail::SpamAssassin::Util::Progress(3)