in reply to finding top 10 largest files
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 ...
|
---|