awk usando matrizes multidimensionais e asort :
awk 'NR==1{ h=$0; } NR>1 { b[NR]=$0;a[$1][length(a[$1])+1]=$3; }
END { print h,"diff";
for (i in a) { asort(a[i]) }
for (k=2;k<=NR;k++) {
split(b[k],sep); max=length(a[sep[1]]);
print b[k],a[sep[1]][max] - a[sep[1]][1]
}
}' file
A saída:
Id str mt no diff
101 2 550 1 350
101 3 540 2 350
101 3 350 3 350
101 4 600 4 350
101 4 700 5 350
102 1 400 1 200
102 4 500 2 200
102 4 350 3 200
102 3 550 4 200
103 3 500 1 250
103 4 300 2 250
103 3 550 3 250