On Wed, Oct 25, 2017 at 9:47 AM, Warren Young warren@etr-usa.com wrote:
This screams out for associative arrays. (Also called hashes, dictionaries, maps, etc.)
That does limit you to CentOS 7+, or maybe 6+, as I recall. CentOS 5 is definitely out, as that ships Bash 3, which lacks this feature.
Nonsense. Every POSIX shell has an associative array called "the filesystem."
(hash=$(mktemp -d); while read addr msgs; do echo $msgs >> "$hash/$addr"; done; cd "$hash"; for x in *; do echo "$x $(paste -s -d+ < $x | bc)"; done;) < msg-counts