Sponsored Content
Full Discussion: awk and count sum ?
Top Forums Shell Programming and Scripting awk and count sum ? Post 302639405 by Corona688 on Friday 11th of May 2012 06:10:38 PM
Old 05-11-2012
Quote:
if total seconds in each place has more than (7 *24 * 3600) then use (7 *24 * 3600)
Both "tampa,win7" and "tampa,unknown" have 2576+157619+3352 seconds here. One of them ends up being subtracted from 7*24*3600, one doesn't. Why?

And wouldn't the numbers always end up negative if you always did that when they were greater than 7*24*3600?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

count of sum of row60 files same patter

i have 60 files that have same pattern tgt_abc1.dat tgt_abc2.dat i want to calculate sum of row count of these files and sum these up and populate that in third file. how can i do that?? example tgt_abc1.dat 2000 tgt_abc2.dat 4000 so want to populate in file xyz.dat 6000 (1 Reply)
Discussion started by: er_zeeshan05
1 Replies

2. Shell Programming and Scripting

Getting Sum, Count and Distinct Count of a file

Hi all this is a UNIX question. I have a large flat file with millions of records. col1|col2|col3 1|a|b 2|c|d 3|e|f 3|g|h footer**** I am supposed to calculate the sum of col1 1+2+3+3=9, count of col1 1,2,3,3=4, and distinct count of col1 1,2,3=c3 I would like it if you avoid... (4 Replies)
Discussion started by: singhabhijit
4 Replies

3. UNIX for Dummies Questions & Answers

how to count number of rows and sum of column using awk

Hi All, I have the following input which i want to process using AWK. Rows,NC,amount 1,1202,0.192387 2,1201,0.111111 3,1201,0.123456 i want the following output count of rows = 3 ,sum of amount = 0.426954 Many thanks (2 Replies)
Discussion started by: pistachio
2 Replies

4. Shell Programming and Scripting

awk count characters, sum, and divide by another column

Hi All, I am another biologist attempting to parse a large txt file containing several million lines like: tucosnp 56762 T Y 228 228 60 23 .CcCcc,,..c.c,cc,,.C... What I need to do is get the frequency of periods (.) plus commas (,) in column 9, and populate this number into another... (1 Reply)
Discussion started by: peromhc
1 Replies

5. Shell Programming and Scripting

sum divided by count

Dear friends, I'm stuck with the task below, I would be thankful for all your replies. INPUT : Date Price Volume 20110601 73052811.61 2845833 20110602 61489062.96 9909230 20110603 72790724.65 1108927 20110606 48299507.20 7435881 20110607 ... (5 Replies)
Discussion started by: hernand
5 Replies

6. Shell Programming and Scripting

Count char, sum and change

Hello, I have some problem in counting char of word, sum and change. I'm not sure shell script can do this. Input data: Sam1 BB BB AA AA BB BB BB Sam2 BB BB AA AA AB AB AB Sam3 BB BB BB AA BB BB BB Sam4 AB AB AB AB AB AB AA Sam5 BB BB AA AA BB BB -- If I count in column 2, B is 9... (3 Replies)
Discussion started by: awil
3 Replies

7. Shell Programming and Scripting

Why sum of recs in awk don't match total rec count?

I'm using awk to determine if a field starting in position 604 for length of 10 is not equal to ALL spaces. It's searching several files which are in the current directory. The below awk indicates that there are 84 records on all files where this field IS NOT equal to ALL spaces ( there are 10... (2 Replies)
Discussion started by: mjf
2 Replies

8. Shell Programming and Scripting

Script Shell: Count The sum of numbers in a file

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)
Discussion started by: chercheur111
3 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. UNIX for Beginners Questions & Answers

Awk: count unique elements in a field and sum their occurence across the entire file

Hi, Sure it's an easy one, but it drives me insane. input ("|" separated): 1|A,B,C,A 2|A,D,D 3|A,B,B I would like to count the occurence of each capital letters in $2 across the entire file, knowing that duplicates in each record count as 1. I am trying to get this output... (5 Replies)
Discussion started by: beca123456
5 Replies
AND.CONF(5)							   File Formats 						       AND.CONF(5)

NAME
/etc/and.conf - general configuration parameters for the auto nice daemon. VERSION
This manual page documents and.conf for and version 1.2.2. DESCRIPTION
This is the general configuration file for and. It stores settings like the default nice level, the renice intervals, the three stages of renicing, and the affinity of the priority database, i.e. the weight of (user, group, command) when resolving nice levels from the data- base. These settings are described below. Comments start with a # in the first column. Empty lines are ignored. Unlike with other configuration files, lines cannot be concatenated with a backslash. Furthermore, this file is case sensitive. and allows for host-specific sections in the configuration file. These work as lines of the form on somehost and work as follows: the parser determines if the host name (as returned by gethostname) matches the extended regular expression that follows the on keyword. If it does, it just keeps processing the file as if nothing had happened. If it does not match, however, everything up to the next on keyword is skipped. So if you want to end a host-specific section, you must write on .* (which matches all hosts) to switch back to normal. Don't forget to kill -HUP the auto nice daemon to enable the changes. SETTINGS
defaultnice The default nice level. A number between 0 and 19. Jobs for which no entry can be found in /etc/and.priorities are reniced to this level, regardless of the CPU time they've used so far. If you prefer to renice unknown jobs gradually, you can do so by supplying three asterisks as (user, group, command) tuple in /etc/and.priorities. The default nice level is 0 interval The default interval between nice checks of the auto nice daemon, in seconds. This value can be overridden by the -i command-line option of and. The default interval is 60 seconds. lv1time lv2time lv3time Ranges for the nice levels. Jobs with less than lv1time seconds CPU time are not reniced; jobs between lv1time and lv2time seconds are reniced to the first level in an.priorities; jobs between lv2time and lv3time seconds to the second level; jobs with more than lv3time seconds are reniced to the third level. Defaults are 120 , 1200 , and 3600 seconds. minuid, mingid Minimum user id and group id to be considered for renicing. Processes whose user id is below minuid are left alone, as are processes with a group id of below mingid. (Note that even if you set minuid to zero, root processes are left alone.) affinity Strategy for picking the right priority entry for a user/group/job triple. The strategy is a permutation of "cgu", "c"ommand, "g"roup, "u"ser. The order specifies the affinity of the priority lookup method. Suppose you have an entry for all jobs of user foo, another entry for all jobs of group bar, and yet another entry for the command baz. Furthermore suppose user foo (who happens to belong to group bar ) starts a job named baz -- which entry should be chosen? This is what the affinity setting means, for example "cug" means an exact match of the command has priority over both an exact match of the user and the group. The default affinity is "cug", which is probably sensible for most cases, since it's the job which takes up CPU time, not the user or group ID. EXAMPLES
Default Configuration # This is the default configuration: defaultnice 0 interval 60 lv1time 300 lv2time 1800 lv3time 3600 affinity cug minuid 0 mingid 0 Default Configuration, with terminals # Normal default configuration for all defaultnice 0 interval 60 lv1time 300 lv2time 1800 lv3time 3600 # Hosts foo, bar, baz are terminals and must # be more responsive, so earlier renice. on (foo|bar) lv1time 120 lv2time 600 lv3time 1200 on .* # This is for all hosts again affinity cug Group-specific Hosts defaultnice 0 interval 60 lv1time 300 lv2time 1800 lv3time 3600 # Normal affinity for all hosts. affinity cug # Hosts bar, baz belong to group foo, which # is privileged on these hosts, so override # affinity. (Note regexp!) on ba[rz] affinity guc on .* minuid 500 mingid 100 FILES
/etc/and.conf General configuration file. Stores default nice level, default interval, the "time zones" and the database lookup affinity. This is what this manual page is about. SEE ALSO
and(8), and.priorities(5), kill(1), regex(7), renice(8) INTERNET
http://and.sourceforge.net/ AUTHOR
The auto nice daemon and this manual page were written by Patrick Schemitz <schemitz@users.sourceforge.net> Unix 27 Mar 2005 AND.CONF(5)
All times are GMT -4. The time now is 06:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy