in reply to Query large tab delimited file by a list

The file1 is probably too large to remember the ids, but you haven't told us how large file2 is. I guess it's much smaller, so you could try hashing the ids from it and then reading the large file line by line and check whether the id was mentioned in file2:

#!/usr/bin/perl use warnings; use strict; my %ids; open my $IDS, '<', 'file2' or die $!; while (<$IDS>) { chomp; $ids{$_} = 1; } open my $OUT1, '>', 'output1' or die $!; open my $LARGE, '<', 'file1' or die $!; my $count_matches = 0; while (<$LARGE>) { my ($pos, $start, $end, $id) = split; ++$count_matches, print {$OUT1} $_ if $ids{$id}; } close $OUT1 or die $!; open my $OUT2, '>', 'output2' or die $!; print {$OUT2} "Number_pos_1st_file\t", $LARGE->input_line_number, "\n" +; print {$OUT2} "Number_pos_2nd_file\t", $IDS->input_line_number, "\n"; print {$OUT2} "Nr_Matching\t", $count_matches, "\n"; print {$OUT2} "Nr_Non_matching\t", $IDS->input_line_number - $count_matches, "\n"; close $OUT2 or die $!;

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.