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,

In reply to Re: Query large tab delimited file by a list by choroba
in thread Query large tab delimited file by a list by Elninh05

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.