I have a tab delimited file that looks like the following:
cluster.1 Adult.1
cluster.2 Comp.1
cluster.3 Adult.2
cluster.3 Pre.3
cluster.4 Pre.1
cluster.4 Juv.2
cluster.4 Comp.4
cluster.4 Adult.3
cluster.5 Adult.2
cluster.6 Pre.5
I would like to count the number of times an entry occurs in column one and then print that to a new column three so that the output would look like this.
cluster.1 Adult.1 1
cluster.2 Comp.1 1
cluster.3 Adult.2 2
cluster.3 Pre.3 2
cluster.4 Pre.1 4
cluster.4 Juv.2 4
cluster.4 Comp.4 4
cluster.4 Adult.3 4
cluster.5 Adult.2 1
cluster.6 Pre.5 1
In the end I plan to delete those rows from my file where column 3 equals 1 but figured it will probably be a two step process to do so. Thanks.