Sponsored Content
Top Forums Shell Programming and Scripting Calculating cumulative frequency Post 302480052 by R0H0N on Tuesday 14th of December 2010 01:18:28 AM
Old 12-14-2010
Code:
sum=0
while read line
do
ele=`echo "$line" | cut -f1`
freq=`echo "$line" | cut -f2`
sum=$((sum + freq))
echo "$ele $freq $sum"
done < inputfile > outputfile

R0H0N
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with calculating frequency of specific word in a string

Input file: #read_1 AWEAWQQRZZZQWQQWZ #read_2 ZZAQWRQTWQQQWADSADZZZ #read_3 POGZZZZZZADWRR . . Desired output file: #read_1 3 #read_1 1 #read_2 2 #read_2 3 #read_3 6 . . (3 Replies)
Discussion started by: perl_beginner
3 Replies

2. Shell Programming and Scripting

Calculating frequency of values within bins

Hi, I am working with files containing 2 columns in which i need to come up with the frequency/count of values in col. 2 falling within specifics binned values of col. 1. the contents of a sample file is shown below: 15 12.5 15 11.2 16 0.2 16 1.4 17 1.6 18 4.5 17 5.6 12 8.6 11 7.2 9 ... (13 Replies)
Discussion started by: ida1215
13 Replies

3. Shell Programming and Scripting

Calculating the epoch time from standard time using awk and calculating the duration

Hi All, I have the following time stamp data in 2 columns Date TimeStamp(also with milliseconds) 05/23/2012 08:30:11.250 05/23/2012 08:30:15.500 05/23/2012 08:31.15.500 . . etc From this data I need the following output. 0.00( row1-row1 in seconds) 04.25( row2-row1 in... (5 Replies)
Discussion started by: ks_reddy
5 Replies

4. UNIX for Dummies Questions & Answers

Calculating cumulative frequency using awk

Hi, I wanted to calculate cumulative frequency distribution of my data that involves several arithmetic calls. I did things in excel but its taking me forever. this is what I want to do: var1.txt contains n observations which I have to compute for frequency which is given by 1/n and subsequently... (7 Replies)
Discussion started by: ida1215
7 Replies

5. Red Hat

Command for cumulative disk space

I wanted to know the Red Hat Linux command for cumulative disk space usage and the free space as df -h gives used and free space individually for the drives. Or, a command to check free space on the server would also be fine. I hope, my question is clear. Please revert with the reply to my... (2 Replies)
Discussion started by: RHCE
2 Replies

6. Shell Programming and Scripting

Calculatin cumulative elapsed time from mm:ss.ss data

Hello all, I got some time duration data like below and I want to compute the cumulative elapsed time. The data is in MM:SS.SS format. I got struck with logic on what to do when it changes from 59:59.ss to 00:00.ss. 59:59.4 59:59.6 59:59.9 00:00.1 00:00.4 00:00.6 00:00.9 I need the... (5 Replies)
Discussion started by: ks_reddy
5 Replies

7. Shell Programming and Scripting

awk or Bash: Cumulative average

For the data I would like to parse down and for each parsing I want a cumulative averaging, stored in an array that can be output. I.e. 546/NR = 546 (546+344)/NR=(546+344)/2 = etc. For N record input I want N values of the average (a block averaging effectively) Any... (3 Replies)
Discussion started by: chrisjorg
3 Replies

8. UNIX for Beginners Questions & Answers

How to find out the maximum cumulative value?

I have a file has thousands of rows and each row has a number and the number can be positive or negative. I want to do the cumulative sum from the first row. How can I find out the maximum cumulative value when I do the sum work row by row. Here is the example: 4 -3 2 -3 -1 1In this case, the... (5 Replies)
Discussion started by: yuejian
5 Replies
cpufreqd-get(1) 														   cpufreqd-get(1)

NAME
cpufreqd-get - Issues "get" commands to cpufreqd. SYNTAX
cpufreqd-get [-l] PARAMETERS
-l list applied Profiles for all cpus. DESCRIPTION
cpufreqd-get issues a command to cpufreqd and reads the returned output. When run without arguments it will issue a "LIST_PROFILES" com- mand, useful for usage with cpufreqd-set. See the PARAMETERS above for more. COMMANDS
LIST_PROFILES cpufreqd-get Name (#1): On Demand High Active on CPU#: 0, 1 Governor: ondemand Min freq: 1000000 Max freq: 1833000 Name (#2): On Demand Low Governor: ondemand Min freq: 1000000 Max freq: 1333000 LIST_APPLIED_PROFILES cpufreqd-get -l CPU#0: "High Speed 1" ondemand 731500-997500 Near the name (between the parenthesis) you can find the index number to use when setting a specific profile with cpufreqd-set. AUTHORS
Mattia Dongili <malattia@linux.it> SEE ALSO
cpufreqd-set(1), cpufreqd(8), cpufreqd.conf(5) Mattia Dongili 2.2.0 cpufreqd-get(1)
All times are GMT -4. The time now is 02:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy