![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
|
||||
|
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 | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|