I have an input file that comes in like this

|M737|5555|Jun 05,2010|753|4562| |M737|5555|Jun 05,2010|123|4562| |Q569|5555|Jun 05,2010|584|4562| |Q569|5555|Jun 05,2010|345|4562| |Q569|5555|Jun 05,2010|215|4562| |Q569|5555|Jun 05,2010|845|4562| |M729|5652|Jun 11,2010|198|4562| |M729|5876|Jun 15,2010|298|4562| |M729|5726|Jun 18,2010|428|4562| |M729|5147|Jun 20,2010|918|4562| |M729|5632|Jun 01,2010|938|4562|
But i would like to use perl to sort and add the last two colums and break it out like this
|M729|5555|Jun 05,2010|498|4562| |M729|5555|Jun 06,2010|978|4562| |M729|5632|Jun 01,2010|938|4562| |M729|5652|Jun 11,2010|198|4562| |M729|5726|Jun 18,2010|428|4562| |M729|5876|Jun 15,2010|298|4562| there were $A m729s and total of 2nd to last row was 898453 and total +of last row was 78665156 ###I just made up those total numbers |M737|5555|Jun 05,2010|123|4562| |M737|5555|Jun 05,2010|563|4562| |M737|5555|Jun 05,2010|725|4562| |M737|5555|Jun 05,2010|753|4562| |M737|5555|Jun 07,2010|913|4562| |M737|5555|Jun 08,2010|921|4562| there were $A m737s and total of 2nd to last row was 898453 and total +of last row was 78665156 ###I just made up those total numbers |Q569|5555|Jun 05,2010|215|4562| |Q569|5555|Jun 05,2010|345|4562| |Q569|5555|Jun 05,2010|457|4562| |Q569|5555|Jun 05,2010|584|4562| |Q569|5555|Jun 05,2010|785|4562| there were $A m737s and total of 2nd to last row was 898453 and total +of last row was 78665156 ###I just made up those total numbers

I would appreciate the helps thanks guys

In reply to Sorting and Arranging data from input file by Homerhrdz

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.