Binning rows while skipping the first column

Hi I have a file that I want to bin.

I am using this code:

awk -F'\t' -v r=40 '{for(i=r;i<=NF;i+=r){for(j=0;j<r;j++){sum+=$(i-j)}printf "%s ", sum/r;sum=0}; printf "\n"}'  file1 > file2

So basically what this code does is that it will averaging every 40 columns (creating bins of 40). But what I want to do is skip the first column and start binning at column 2.

For example:

morrow  2  4  5  6  7  6 .... #40
taylor     2  5  6  2  4  90....#40

I want it to skip the first column (name) and begin the regular binning at column 2.

:confused:

thanks

---------- Post updated at 09:58 PM ---------- Previous update was at 04:53 PM ----------

anyone?

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.

---------- Post updated at 07:50 ---------- Previous update was at 07:48 ----------

What do you mean by "binning"? What should be the output?

I think you just have to add 1 to the column number?

awk -F'\t' -v r=40 '{for(i=r+1;i<=NF;i+=r){for(j=0;j<r;j++){sum+=$(i-j)}printf "%s ", sum/r;sum=0}; printf "\n"}'  file1 > file2

(not tested)