Sponsored Content
Top Forums UNIX for Advanced & Expert Users Summation of the column value in an interval. Post 302317065 by varungupta on Monday 18th of May 2009 03:14:09 AM
Old 05-18-2009
Summation of the column value in an interval.

Hey,

I have a file with following data..
and I want to get the summation of 10th column. And this happens in every 10 seconds for a minute max.

242001 A mqsitst 794864 1249516 0 60 20 293050400 77016 * 02:05:33 - 0:04 DataFlowEngine EAITIBR2_BROKER 384403e1-1001-0000-0080-cc759314a02e IDS_CCASS 0
242001 A mqsitst 978998 1249516 0 60 20 24284a400 56092 * 02:05:33 - 0:03 DataFlowEngine EAITIBR2_BROKER 9fa202e1-1001-0000-0080-cc759314a02e 21CD1 0
242001 A mqsitst 1040482 1134684 0 60 20 13d86400 78684 * 02:05:35 - 0:04 DataFlowEngine EAIDQBR2_BROKER 6f8aa7d6-1001-0000-0080-be57c7f1134d WAMS1 0

The BOLD faced has to be added and its in the 10th column.

What should i do to make it easily done ?

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to perfrom summation for particular delimited field?

Hi, Please help to share your thought about how to perfrom summation for particular delimited field, and output to the particular file based on -rw-r--r-- 1 abc other 3094 Oct 19 09:40 0132019832-ps5_online_cdrm.unl -rw-r--r-- 1 abc other 1588 Oct 19 09:47... (2 Replies)
Discussion started by: rauphelhunter
2 Replies

2. Shell Programming and Scripting

compare the interval of 2 numbers of input2with interval of several numbers of input1

Help plz Does any one have any idea how to compare interval ranges of 2 files. finding 1-4 (1,2,3,4) of input2 in input1 of same key "a" values (5-10, 30-40, 45-60, 80-90, 100-120 ). Obviously 1-4 is not one of the range with in input1 a. so it should give out of range. finding 30-33(31,32,33)... (1 Reply)
Discussion started by: repinementer
1 Replies

3. UNIX for Dummies Questions & Answers

summation of values coming in a row.

Hi All, I need to sum values in a row. eg: input is: sum,value1,value2,value3,.....,value N Required Output: sum,<summation of N values> Please help me... (1 Reply)
Discussion started by: MrGopal666
1 Replies

4. Shell Programming and Scripting

How to shift values in new column after certain interval?

Hello everyone, my data is in a format as below a a a a a a a a a a a a a a a (8 Replies)
Discussion started by: jojo123
8 Replies

5. Shell Programming and Scripting

Summation of column value in flat file

Hello Guys Please find my below requirement I have a flat file with column headers in first line and data The structure like below col1 col2 col3 A 1 2 B 3 4 C 5 6 Say I have to take the summation of col2 (that will depend on the... (2 Replies)
Discussion started by: Pratik4891
2 Replies

6. Shell Programming and Scripting

calculating column summation in a directory of flat files

Hello Guru s I need your kind help to solve my below issue I have a directory of flat files and have to calculate sum of some columns from the flat file . Say for flat file 302 I need the column summation of 2 and 3 rd column For flat file 303 I need the column summation of 5 and... (2 Replies)
Discussion started by: Pratik4891
2 Replies

7. Shell Programming and Scripting

Awk - Summation in Proper decimal Format

Hi I am executing below command to do summation on 46th coloumn. cat File1| awk -F"|" '{p += $46} END { printf"Column Name | SUM | " p}' I am getting output as Column Name | SUM | 1.01139e+10 Here I want output in Proper decimal format. Can someone tell me what change is required for same? (1 Reply)
Discussion started by: sanranad
1 Replies

8. Shell Programming and Scripting

Modification of Summation Script

hi guys, i have a script that basically just sums up the values of 2 particular columns in a file, grouped by the columns specified as well The script is quite long, but it's basically just repetitive.. just for each condition. This script only accepts one type of input file. ... (22 Replies)
Discussion started by: ramneim
22 Replies

9. Shell Programming and Scripting

Summation of a particular column which are in different folders

I have three folders named f1, f2 and f3. The file names are same in all these folders. I would like to get the summation of the second column from all files. How can I do this ? file1 in f1 folder 143 143.69 60.2 81.30 40.4 62.39 166.3 83.38 107.2 60.30 37.5 144 192.62 107.9... (3 Replies)
Discussion started by: edisonjoe
3 Replies

10. UNIX for Beginners Questions & Answers

Awk/sed summation of one column based on some entry in first column

Hi All , I am having an input file as stated below Input file 6 ddk/djhdj/djhdj/Q 10 0.5 dhd/jdjd.djd.nd/QB 01 0.5 hdhd/jd/jd/jdj/Q 10 0.5 512 hd/hdh/gdh/Q 01 0.5 jdjd/jd/ud/j/QB 10 0.5 HD/jsj/djd/Q 01 0.5 71 hdh/jjd/dj/jd/Q 10 0.5 ... (5 Replies)
Discussion started by: kshitij
5 Replies
WATCH(1)							Linux User's Manual							  WATCH(1)

NAME
watch - execute a program periodically, showing output fullscreen SYNOPSIS
watch [-bdehpvtx] [-n seconds] [--beep] [--color] [--differences[=cumulative]] [--errexit] [--exec] [--help] [--interval=seconds] [--no-title] [--precise] [--version] command DESCRIPTION
watch runs command repeatedly, displaying its output and errors (the first screenfull). This allows you to watch the program output change over time. By default, the program is run every 2 seconds; use -n or --interval to specify a different interval. Normally, this interval is interpreted as the amout of time between the completion of one run of command and the beginning of the next run. However, with the -p or --precise option, you can make watch attempt to run command every interval seconds. Try it with ntptime and notice how the fractional sec- onds stays (nearly) the same, as opposed to normal mode where they continuously increase. The -d or --differences flag will highlight the differences between successive updates. Using --differences=cumulative makes highlighting "sticky", presenting a running display of all positions that have ever changed. The -t or --no-title option turns off the header showing the interval, command, and current time at the top of the display, as well as the following blank line. The -b or --beep option causes the command to beep if it has a non-zero exit. watch will normally run until interrupted. If you want watch to exit on an error from the program running use the -e or --errexit options, which will cause watch to exit if the return value from the program is non-zero. By default watch will normally not pass escape characters, however if you use the --c or --color option, then watch will interpret ANSI color sequences for the foreground. NOTE
Note that command is given to "sh -c" which means that you may need to use extra quoting to get the desired effect. You can disable this with the -x or --exec option, which passes the command to exec(2) instead. Note that POSIX option processing is used (i.e., option processing stops at the first non-option argument). This means that flags after command don't get interpreted by watch itself. EXAMPLES
To watch for mail, you might do watch -n 60 from To watch the contents of a directory change, you could use watch -d ls -l If you're only interested in files owned by user joe, you might use watch -d 'ls -l | fgrep joe' To see the effects of quoting, try these out watch echo $$ watch echo '$$' watch echo "'"'$$'"'" To see the effect of precision time keeping, try adding -p to watch -n 10 sleep 1 You can watch for your administrator to install the latest kernel with watch uname -r (Note that -p isn't guaranteed to work across reboots, especially in the face of ntpdate or other bootup time-changing mechanisms) BUGS
Upon terminal resize, the screen will not be correctly repainted until the next scheduled update. All --differences highlighting is lost on that update as well. Non-printing characters are stripped from program output. Use "cat -v" as part of the command pipeline if you want to see them. Combining Characters that are supposed to display on the character at the last column on the screen may display one column early, or they may not display at all. Combining Characters never count as different in --differences mode. Only the base character counts. Blank lines directly after a line which ends in the last column do not display. --precise mode doesn't yet have advanced temporal distortion technology to compensate for a command that takes more than interval seconds to execute. watch also can get into a state where it rapid-fires as many executions of command as it can to catch up from a previous exe- cutions running longer than interval (for example, netstat taking ages on a DNS lookup). AUTHORS
The original watch was written by Tony Rems <rembo@unisoft.com> in 1991, with mods and corrections by Francois Pinard. It was reworked and new features added by Mike Coleman <mkc@acm.org> in 1999. The beep, exec, and error handling features were added by Morty Abzug <morty@frakir.org> in 2008. On a not so dark and stormy morning in March of 2003, Anthony DeRobertis <asd@suespammers.org> got sick of his watches that should update every minute eventually updating many seconds after the minute started, and added microsecond precision. Uni- code support was added in 2009 by Jarrod Lowe <procps@rrod.net>. 2010 Mar 01 WATCH(1)
All times are GMT -4. The time now is 01:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy