Sponsored Content
Top Forums Shell Programming and Scripting how to get the sum of all the lines in the file Post 302217340 by sdosanjh on Tuesday 22nd of July 2008 01:54:22 PM
Old 07-22-2008
dear all...thanx for your quick responses..... it helped me a lot to solve the issue....
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sum of all lines in file without roundup with awk

Hi, I have a file and I want to sum all the numbers in it. Example of the file: 0.6714359 -3842.59553830551 I used your forum (https://www.unix.com/shell-programming-scripting/74293-how-get-sum-all-lines-file.html) and found a script, what worked for me: awk '{a+=$0}END{print a}'... (8 Replies)
Discussion started by: mario8eren
8 Replies

2. Shell Programming and Scripting

Sum value from selected lines script (awk,perl)

Hello. I face this (2 side) problem. Some lines with this structure. ........... 12345678 4 12345989 13 12346356 205 12346644 74 12346819 22 ......... The first field (timestamp) is growing (or at least equal). 1)Sum the second fields if the first_field/500 are... (8 Replies)
Discussion started by: paolfili
8 Replies

3. Shell Programming and Scripting

sum of a column and selecting lines with value above threshold

Hi again, I need to further process the results of a previous manipulation. I have a file with three columns e.g. AAA5 0.00175 1.97996e-06 AAA5 0.01334 2.14159e-05 AAA5 0.01340 4.12155e-05 AAA5 0.01496 1.10312e-05 AAA5 0.51401 0.0175308 BB0 0.00204 2.8825e-07 BB0 0.01569 7.94746e-07 BB0... (6 Replies)
Discussion started by: f_o_555
6 Replies

4. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

5. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum

Hi friends, This is sed & awk type question. It is slightly different from my previous question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers (but no more than 10 numbers in series) whenever i find it and produce an output file with the... (4 Replies)
Discussion started by: kaaliakahn
4 Replies

6. Shell Programming and Scripting

Sum from successive lines following date header to create data for graphing connections

Hi, I have a log file created from a load balancer showing connections to each member of a two member pool with the following format (where first field is source IP, second field is load balanced IP address and third field is destination member. I need to plot a graph by date/time and number of... (5 Replies)
Discussion started by: shog63
5 Replies

7. UNIX for Dummies Questions & Answers

awk to sum column field from duplicate row/lines

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

8. Shell Programming and Scripting

Sum product of even/odd lines

Hi, I have a text file like this 6.0000E-02 0.00000E+00 0.0000 0.00000E+00 0.0000 7.0000E-02 5.00000E-10 1.0000 5.00000E-10 1.0000 8.0000E-02 3.00000E-09 0.4082 3.00000E-09 0.4082 9.0000E-02 3.50000E-09 0.3780 3.50000E-09 0.3780 1.0000E-01 1.00000E-09... (2 Replies)
Discussion started by: f_o_555
2 Replies

9. Shell Programming and Scripting

Shell script count lines and sum numbers from multiple files

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)
Discussion started by: Elly
5 Replies

10. Shell Programming and Scripting

awk to update file with sum of matching fields in another file

In the awk below I am trying to add a penalty to a score to each matching $1 in file2 based on the sum of $3+$4 (variable TL) from file1. Then the $4 value in file1 is divided by TL and multiplied by 100 (this valvue is variable S). Finally, $2 in file2 - S gives the updated $2 result in file2.... (2 Replies)
Discussion started by: cmccabe
2 Replies
POE::Filter::RecordBlock(3pm)				User Contributed Perl Documentation			     POE::Filter::RecordBlock(3pm)

NAME
POE::Filter::RecordBlock - translate between discrete records and blocks of them SYNOPSIS
Hello, dear reader. This SYNOPSIS does not contain a fully functioning sample program because your humble documenter cannot come up with a short, reasonable use case for this module. Please contact the maintainer if this module is useful to you. Otherwise you may wake up one morning to discover that it has been deprecated. $filter = new POE::Filter::RecordBlock( BlockSize => 4 ); $arrayref_of_arrayrefs = $filter->get($arrayref_of_raw_data); $arrayref_of_raw_chunks = $filter->put($arrayref_of_arrayrefs); $arrayref_of_raw_chunks = $filter->put($single_arrayref); $arrayref_of_leftovers = $filter->get_pending; $arrayref_of_leftovers = $filter->put_pending; DESCRIPTION
On input, POE::Filter::RecordBlock translates a stream of discrete items into a "block" of them. It does this by collecting items until it has BlockSize of them, then returning the lot of them in an array reference. On output, this module flattens array references. This module may be deprecated in the future. Please contact the maintainer if this module is useful to you. PUBLIC FILTER METHODS
In addition to the usual POE::Filter methods, POE::Filter::RecordBlock supports the following. new new() takes at least one mandatory argument, BlockSize, which must be defined and greater than zero. new() also accepts a CheckPut Boolean parameter that indicates whether put() should check for the proper BlockSize before allowing data to be serialized. Using CheckPut is not recommended, as it enables a write buffer in the filter, therefore breaking put() for normal use. put_pending put_pending() returns an arrayref of any records that are waiting to be sent. It is the outbound equivalent of POE::Filter's get_pending() accessor. put_pending() is not part of the canonical POE::Filter API, so nothing will use it. It's up to applications to handle pending output, whenever it's appropriate to do so. blocksize blocksize() is an accessor/mutator for POE::Filter::RecordBlock's BlockSize value. checkput checkput() is an accessor/mutator for POE::Filter::RecordBlock's CheckPut flag. SEE ALSO
POE::Filter for more information about filters in general. POE::Filter::Stackable for more details on stacking filters. BUGS
This filter may maintain an output buffer that no other part of POE will know about. This filter implements a highly specialized and seemingly not generally useful feature. Does anyone use this filter? This filter may be deprecated if nobody speaks up. AUTHORS &; COPYRIGHTS The RecordBlock filter was contributed by Dieter Pearcey. Documentation is provided by Rocco Caputo. Please see the POE manpage for more information about authors and contributors. perl v5.14.2 2012-05-15 POE::Filter::RecordBlock(3pm)
All times are GMT -4. The time now is 03:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy