I need help to process a column entry via awk. Below are the operations i want to try:
- To divide a column in user-defined chunk size;
- count and sum each entry for every chunk to eventually give average per entry which will be eventually the chunk size.
For instance, below is a list:
1
2
3
4
5
6
7
8
9
10
11
12
Here, I want to use a chunk size of 4 (but in my case it can vary from case to case):
- chunk1
1 2 3 4
- chunk2
5 6 7 8
- chunk3
9 10 11 12
After processing, I would like to have:
5
6
7
8
which is the average for the entries in position 1, 2, 3 and 4, respectively, across all chunks.