distance

You may want to get the program r.distance.

GRASS 4.1 > r.distance help

Usage:
r.distance [-lq] maps=map1,map2 [fs=name]

Flags:
  -l include category labels in the output
  -q run quietly

Parameters:
  maps maps for computing inter-class distances
    fs output field separator
         default: :

Here is an example of the output:

GRASS 4.1 > r.distance -l maps=dist,dist
Reading map dist@jackson ... 100%
Reading map dist@jackson ... 100%
Processing...
1:1:0:693510:3600110:693510:3600110:1:1
1:2:5942.6929922385:695390:3588470:696490:3582630:1:2
2:1:5942.6929922385:696490:3582630:695390:3588470:2:1
..etc

You should be able to get the program off moon.

Bill Jackson
ENL
USA-CERL