perl -lp with
$t+=$_,$r{$.}+=$_,$c[$n++%4]+=$_ for((split)[1..4])x/^\s*\d/;print$_.=
+" $r{$.}"
}{print sprintf" %10d %10d %10d %10d $t",@c[0..3]
gives me
COUNTY 2001 2002 2003 2004
------ ------ ------ ------ ------
26005 432 505 547 555 2039
26021 910 984 1026 1077 3997
26023 225 282 272 299 1078
26025 711 796 809 899 3215
26027 250 319 318 313 1200
26059 196 221 242 292 951
26077 1170 1371 1439 1439 5419
26149 355 415 346 367 1483
26159 414 434 504 493 1845
4663 5327 5503 5734 21227
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.