The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Averaging multiple columns gisele_l Shell Programming and Scripting 4 4 Weeks Ago 05:53 PM
Averaging all fields while counting repeated records nxp Shell Programming and Scripting 0 10-15-2009 06:15 PM
Averaging segments kylle345 Shell Programming and Scripting 11 09-16-2009 12:04 PM
averaging column values with awk johnmillsbro Shell Programming and Scripting 18 01-26-2009 01:20 PM
AWK - averaging $3 by info in $1 itisthus Shell Programming and Scripting 3 11-03-2008 06:12 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 1 Week Ago
Muhammad Rahiz Muhammad Rahiz is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 7
Averaging

Hello all,

I'm trying to perform an averaging procedure which selects a selection of rows, average the corresponding value, selects the next set of rows and average the corresponding values etc.

The data below illustrates what I want to do. Given two columns (day and value),
I want to perform an annual average. This means, average the first 365 rows, followed by the next 365 rows, and the next 365 rows.
i.e.
average line 1 to 365 (no. of lines = 365)
average line 366 to 730 (no. of lines = 365)
average line 731 to 1095 (no. of lines = 365)

But there is a problem. Every four years, the calendar has one additional day i.e. leap year. So instead of 365, we have 366. Eventually, the whole averaging pattern should look something like

average line 1 to 365 (no. of lines = 365)
average line 366 to 730 (no. of lines = 365)
average line 731 to 1095 (no. of lines = 365)
average line 1096 to 1461 (no. of lines = 366)
average line 1462 to 1827 (no. if lines = 365)
...

Any suggestions?

Thanks.

day value
1
2
3
...
365
1
2
3
...
365
1
2
3
...
366
1
2
3
365
  #2 (permalink)  
Old 1 Week Ago
thegeek thegeek is offline
Registered User
  
 

Join Date: Apr 2009
Location: /usr/bin/vim
Posts: 429
ok, you are explanations are clear.

Do total/366 only at every 4th time... What suggestion you want ?! or What is the doubt you have here ?
  #3 (permalink)  
Old 1 Week Ago
skinnygav skinnygav is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 8
Hi i'm quite inexeperienced but my suggestion would be to use the modulus of 4 for your trigger to /366 instead of /365.

Hope this helps you out a bit
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0