<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 won't get a matrix, but the answer would be the same.</p>

<pre><code>sort 2-col.txt | uniq -c
</code></pre>

<p>Or with awk.</p>

<pre><code>awk -v OFS="\t" '{cnt[$0]+=1} END{for (key in cnt) {print key,cnt[key]} }' 2-col.txt
</code></pre>

<p>Or with perl.</p>

<pre><code>perl -lane '$cnt{$_}++; END { foreach $key (keys %cnt) {print "$key\t$cnt{$key}"} }' 2-col.txt
</code></pre>
