in reply to Accumulate values for each data field
(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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Accumulate values for each data field
by JobC (Acolyte) on Feb 10, 2016 at 00:37 UTC | |
by Cristoforo (Curate) on Feb 10, 2016 at 02:24 UTC |