[Solved] awk Column difference

Hi,

I've got what is probably quite an easy little (presumably) awk problem that I just can't seem to work out (mental block...I've already spent ages getting the data into this format!). I want to work out the difference between rows for certain columns. for example:

1359142876 RED 14 BLUE 3 GREEN 71 BLACK 65 
1359135610 RED 13 BLUE 3 GREEN 71 BLACK 65
1359128178 RED 10 BLUE 3 GREEN 68 BLACK 60 
1359121257 RED 8 BLUE 3 GREEN 66 BLACK 52 
ETC

to

1359142876 RED 14 BLUE 3 GREEN 71 BLACK 65 
1359135610 RED 1 BLUE 0 GREEN 0 BLACK 0
1359128178 RED 3 BLUE 0 GREEN 3 BLACK 5 
1359121257 RED 2 BLUE 0 GREEN 2 BLACK 8 
ETC

(contents of the first column doesn't matter).

The other thing is, we don't know how many columns there will be (could be additional pairs, "PINK 10" for example).

As always any help would be appreciated

Here is for fixed number of columns:

awk 'NR==1 {
 f3=$3;f5=$5;f7=$7;f9=$9;
 print
}NR!=1 {
 t3=$3;t5=$5;t7=$7;t9=$9;
 $3=f3-$3;$5=f5-$5;$7=f7-$7;$9=f9-$9;
 f3=t3;f5=t5;f7=t7;f9=t9;
 print
}' file

Here is generic code:

awk 'NR==1 {
 for(i=3;i<=NF;i+=2) {
  a=$i;
 }
 print
}NR!=1 {
 for(j=3;j<=NF;j+=2) {
  t[j]=$j;
  $j=a[j]-$j;
  a[j]=t[j];
 }
 print
}' file
awk '{for(f=3; f<=NF;f+=2){
        if(NR==1)A[f]=$f;else{B[f]=A[f]-$f;A[f]=$f; $f=B[f]}
}}1' file

Brilliant, both work a treat, thank you!

And I _think_ I follow what is going on, bonus!