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
FM(1)							      General Commands Manual							     FM(1)

NAME
fmscan - scan FM band for radio stations SYNOPSIS
fm [ -h ] [ -d device ] [ -t tuner ] [ -s freq ] [ -e freq ] [ -i freq ] [ -q ] DESCRIPTION
fmscan is a program to scan a frequency band for radio stations, using the video4linux interface introduced in 2.1.x series Linux kernels. It shows which ones have a accumulated signal strength of 50% or higher. OPTIONS -h Print a usage message to standard output, and exit. -d device Sets device as the device to tune. The default is /dev/radio0. -t tuner Sets tuner as the tuner on the selected device to adjust. The default is tuner 0. Most radio devices have only a single tuner. -s freq Starting frequency for scan, in MHz. Default: 87.9. -e freq Ending frequency for scan, in MHz. Default: 107.9. -i freq Increment between scanned channels, in MHz. Default: 0.2. -t percent Signal strength threshold to consider a channel. Default: 50%. -q Quiet mode. Suppresses progress output. BUGS
This process can take a while, and results vary greatly depending on the radio card in use. If your card's hardware cannot report signal strength, it will not produce useful results. This program may not do much if your radio card's driver doesn't support fine tuning in 1/16000 MHz offsets. By default, V4L2 assumes 1/16 MHz tuning units, which introduces evil rounding errors on many frequencies. Supports only tuner 0 on any given device. SEE ALSO
Additional documentation: /usr/doc/fmtools/README The fmtools homepage: http://benpfaff.org/fmtools AUTHORS
Russell Kroll <rkroll@exploits.org>, now maintained by Ben Pfaff <blp@cs.stanford.edu.>. This manpage written by Ben Pfaff. fmscan 1.0.2 FM(1)
All times are GMT -4. The time now is 11:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy