Hi Conferes,

I have a large file with identifer in each row of this file. Equal ids are unevenly spreaded within the file. I need the data after the id, so I have to collect all data for the same id, grepping for each id the whole file. is takes a long time!
My idea is first to sort the file by id, so that I can find the first position in the file with a id, reading lines till the id changes.

eg: 
10 data1
12 data2
13 data4
1  data5
10 data6
12 data7
2  data8
10 data11

sorted: 
1 data5
10 data1 # beginn id 10
10 data11
10 data6 #end id 10
12 data2
12 data7
13 data4

should I load the file in an array, sort and print it? Or are there better ways (the file has 183M)?

Thanks and GOD saves PERL!

Guido

In reply to sort large file by Murcia

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.