<p>Hi All,
I intersected to data sets and I have two columns like:</p>

<pre><code>m01      m01 
m01      m02
m01      m05
m01      m032
m01      m02
m01      m01
m02      m06
m02      m01
m02      m02
m02      m09
...     ...
m0500     m023
...
</code></pre>

<p>I would like to get number of matches with others like:</p>

<pre><code>           m01    m02     m03     ......

 m01       25      45      98      .....
 m02       90      223     12      ......
  .
  .
</code></pre>

<p>Would you please help me how I can do that?</p>

<p>Thank you very much</p>

<p>You didn't say which language you are using. I guess since you tagged it with awk and perl, that's what you want?</p>

<p>Anyway, if you were using <a href="http://www.r-project.org]">R</a>, you could do it with a call to <code>table</code>:</p>

<pre><code>## Maybe you have this in a tab delimited file already
&gt; dat &lt;- read.table('/path/to/2-column-file.txt')
## but I'll generate a random table that looks close-enough to your data:
&gt; set.seed(1)
&gt; dat &lt;- data.frame(x1=rep(c('m01', 'm02', 'm03'), each=10),
                    x2=sample(c('m01', 'm02', 'm03'), 30, replace=TRUE))
&gt; head(dat)
    x1  x2
1| m01 m01
2| m01 m02
3| m01 m02
4| m01 m03
5| m01 m01
6| m01 m03

&gt; table(dat$x1, dat$x2)
      m01 m02 m03
  m01   3   4   3
  m02   2   3   5
  m03   4   4   2
</code></pre>
