Something like this ?

(The code is as clear as your specifications)

>perl -anF, -e "$x{$F[3]}+=$F[1] if $F[1]=~/^\d+/}{print qq|$x{$_}\t$_ +\n| for sort keys %x" data1.txt 2 "456.123.00" 2 "456.147.00" 6 "456.321.07" 5 "456.321.08" 5 "456.321.09" 12 "456.321.11" 6 "456.321.12" 1 "456.321.15" 1 "456.321.29" 1 "456.321.30" 1 "456.321.31" 1 "456.321.32" 1 "456.325.10" 2 "456.325.11" 2 "456.325.15" 2 "456.325.30" 2 "456.325.31" 8 "460.339.01" 16 "460.339.02" 2 "460.339.03" 4 "460.339.04"

        "Think of how stupid the average person is, and realize half of them are stupider than that." - George Carlin


In reply to Re: Accumulate values for each data field by NetWallah
in thread Accumulate values for each data field by JobC

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.