I think a good way to do this is to write a Perl script selecting the files larger than, say, 20M; and do not care with the sorting in it. Then you can easily sort|head the resulting few files.

By the way, I have some old code doing something similar. I have a file with a lot of records, and I have to select the 64 "best" records. Here's the code, with omissions (##)

## ... HEADER STUFF ... @sellpt= (0)x64; @sellx= @sellpt; @selly= @sellpt; ## ... MORE HEADER STUFF, OPENING HANDLE "VAR" ... while (<VAR>) { my($p,$x,$y); ## FILLING ($x,$y,$p) WITH DATA FROM RECORDS, MUST GET THE ONE +S WITH LARGEST $p $sellpt[-1]<$p and do { my ($u, $v)= (0, 0+@sellpt); defined ($sellpt[int(($u+$v)/2)]) or die qq([D30] $u $v (@sellpt)); while ($u<$v) { if ($p<$sellpt[int(($u+$v)/2)]) { $u= int(($u+$v)/2)+1 } else { $v= int(($u+$v)/2) }; } @sellpt= (@sellpt[0..$u-1], $p, @sellpt[$u..@sellpt-2] +); @sellx= (@sellx[0..$u-1], $x, @sellx[$u..@sellx-2]); @selly= (@selly[0..$u-1], $y, @selly[$u..@selly-2]); }; ## ... SOME MORE STUFF ... }; ## ... AND SOME MORE, WRITING OUT @sellx,@selly IN SUITABLE FORMAT ...

In reply to Re: finding top 10 largest files by ambrus
in thread finding top 10 largest files by bfdi533

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.