Sponsored Content
Full Discussion: Hourly averaging using Awk
Top Forums Shell Programming and Scripting Hourly averaging using Awk Post 302542650 by gd9629 on Thursday 28th of July 2011 09:27:31 AM
Old 07-28-2011
Hourly averaging using Awk

Hey all,

I have a set of 5-second data as shown below. I need to find an hourly average of this data.

Code:
date                         co2
25/06/2011 08:04:00        8.30
25/06/2011 08:04:05        8.31
25/06/2011 08:04:10        8.32
25/06/2011 08:04:15        8.33
25/06/2011 08:04:20        8.32
25/06/2011 08:04:25        8.31
25/06/2011 08:04:30        8.30
25/06/2011 08:04:35        8.29
25/06/2011 08:04:40        8.34
25/06/2011 08:04:45        8.43
25/06/2011 08:04:50        8.33
25/06/2011 08:04:55        8.32
25/06/2011 08:05:00        8.31
25/06/2011 08:05:05        8.32
25/06/2011 08:05:10        8.30
25/06/2011 08:05:15        8.29
25/06/2011 08:05:20        8.30
25/06/2011 08:05:25        8.31
25/06/2011 08:05:30        8.33
25/06/2011 08:05:35        8.32
25/06/2011 08:05:40        8.32
25/06/2011 08:05:45        8.35
25/06/2011 08:05:50        8.34
25/06/2011 08:05:55        8.36
25/06/2011 08:06:00        8.37
25/06/2011 08:06:05        8.34
25/06/2011 08:06:10        8.35
25/06/2011 08:06:15        8.35
25/06/2011 08:06:20        8.34
25/06/2011 08:06:25        8.38
25/06/2011 08:06:30        8.35
25/06/2011 08:06:35        8.36
25/06/2011 08:06:40        8.32
25/06/2011 08:06:45        8.31
25/06/2011 08:06:50        8.30
25/06/2011 08:06:55        8.32

So above is just 3 minutes worth of data! Is there a way to average the co2 values into hourly data?

The co2 data is in column 13 of my dataframe. I also data in column 15 that I need to hourly average too!

Thanks a lot!

Last edited by gd9629; 07-29-2011 at 06:06 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK - averaging $3 by info in $1

Hello, I have three columns of data of the format below: <name> <volume> <size> a 2 1.2 a 2 1.1 b 3 1.7 c 0.7 1.9 c 0.7 1.9 c 0.7 1.8 What I... (3 Replies)
Discussion started by: itisthus
3 Replies

2. Shell Programming and Scripting

averaging column values with awk

Hello. Im just starting to learn awk so hang in there with me...I have a large text file formatted as such everything is in a single column ID001 value 1 value 2 value....n ID002 value 1 value 2 value... n I want to be able to calculate the average for values for each ID from the... (18 Replies)
Discussion started by: johnmillsbro
18 Replies

3. UNIX for Dummies Questions & Answers

Maintaining HOURLY backups

I have a system where i take hourly back-ups of the system.The script for maintaining full backup for the last 5 days is find /backup/server -type f -mtime +4 -exec rm -f {} \; works fine for keeping the files of some 5 days old. In the case of hourly backups.How do we write to keep... (2 Replies)
Discussion started by: ravi55055
2 Replies

4. UNIX for Dummies Questions & Answers

Averaging the rows using 'awk'

Dear all, I have the data in the following format. I want to do average of each NR= 5 (rows) for all the 3 ($1,$2, $3) columns and want to print average result in another file in the same format. I dont know how to write code for this in 'awk', can some one help me to write a code for this in... (1 Reply)
Discussion started by: arvindr
1 Replies

5. Shell Programming and Scripting

Averaging in increments using awk & head/tail

Hi, I only have a very limited understanding and experience with writing code and I was hoping I could get some help. I have a dataset of two columns (txt format, numbers in each row separated by a tab) Eg. 1 5 2 5 3 6 4 7 5 6 6 6 7 ... (5 Replies)
Discussion started by: Emred_Skye
5 Replies

6. Shell Programming and Scripting

Averaging data every 30 mins using AWK

A happy Monday to you all, I have a .csv file which contains data taken every 5 seconds. I want to average these 5 second data points into 30 minute averages! date co2 25/06/2011 08:04 8.31 25/06/2011 08:04 8.32 25/06/2011 08:04 8.33... (18 Replies)
Discussion started by: gd9629
18 Replies

7. Shell Programming and Scripting

Averaging help in awk

Hi all, I have a data file like below, where Time is in the second column DATE TIME FRAC_DAYS_SINCE_JAN1 2011-06-25 08:03:20.000 175.33564815 2011-06-25 08:03:25.000 175.33570602... (10 Replies)
Discussion started by: gd9629
10 Replies

8. Shell Programming and Scripting

Loop for row-wise averaging of multiple files using awk

Hello all, I need to compute a row-wise average of files with a single column based on the pattern of the filenames. I really appreciate any help on this. it would just be very difficult to do them manually as the rows are mounting to 100,000 lines. the filenames are as below with convention as... (2 Replies)
Discussion started by: ida1215
2 Replies

9. Shell Programming and Scripting

Crontab on hourly basis

Hi.. I need to run the script on hourly basis. How do I write the crontab on hourly basis i.e, 9:00, 10:00.....22:00.. 23:00 hours Please let me know if the below is correct one for crontab on hourly basis. 00 * * * * ksh myscript.ksh > /dev/null Regards, John (3 Replies)
Discussion started by: scriptscript
3 Replies

10. Shell Programming and Scripting

How to perform averaging of values for particular timestamp using awk or anythoing else??

I have a file of the form. 16:00:26,83.33 16:05:26,83.33 16:10:26,83.33 16:15:26,83.33 16:20:26,90.26 16:25:26,83.33 16:30:26,83.33 17:00:26,83.33 17:05:26,83.33 17:10:26,83.33 17:15:26,83.33 17:20:26,90.26 17:25:26,83.33 17:30:26,83.33 For the timestamp 16:00:00 to 16:55:00, I need to... (5 Replies)
Discussion started by: Saidul
5 Replies
MOUNT_CHFS(8)						    BSD System Manager's Manual 					     MOUNT_CHFS(8)

NAME
mount_chfs -- mount a CHFS flash file system SYNOPSIS
mount_chfs DESCRIPTION
Mounts a flash file system from a flash(4) device. CHFS file systems can be only mounted from flash devices. For regular block devices like SSD drives or USB drives, please use a regular file system. The file system will be created during the first mount. CHFS stands for Chip File System. EXAMPLES
mount_chfs /dev/flash0 /mnt SEE ALSO
flash(4), fstab(5), mount(8), flash(9) HISTORY
CHFS was originally called ChewieFS during development. The name was changed to avoid legal issues and to have a more neutral name. AUTHORS
CHFS was developed at the Department of Software Engineering, University of Szeged, Hungary. BUGS
CHFS has a few known bugs as of 2011. Writing the FS full can cause problems. Truncating a file and growing it again can cause the new bytes not having all zeroes, but filled with the old content instead. BSD
November 29, 2011 BSD
All times are GMT -4. The time now is 06:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy