Find matching pattern between columns and count for each distinct element in one column
Find matching pattern between columns and count for each distinct element in one column I have a tab delimited file with around 70 million rows like the following; chr1:25851453-25869713W:6655:4522:4234:2258:2508:S 6655 chr1:25851453-25869713W:6655:4523:4234:2258:2508:A 6655 chr1:25851453-25869713W:0000:4524:4234:2258:2508:S 6655 chr1:25851453-25869713W:6655:4525:4234:2258:2508:S 6655 chr1:26235471-26237662W:6663:124:1864:311:455:S 6663 chr1:26235471-26237662W:6663:125:1864:311:455:S 6663 I am trying to report for each distinct element in column 2, how many times the pattern after the second ":" in column 1 matches the pattern in column 2. So something like this for the above example; 6655 matches 3 6655 mismatches 1 6663 matches 2 6663 mismatches 0 (to be specific there are 15559 distinct values in column 2) Thanks! What have you tried so far? Could you post some code you've done? – matov...