calculate user sum by Shell

I have a file like this :

iphonevisitor -> 125
ipadvisitor -> 200
iphonemember -> 120
ipadmember -> 100
macvisitor -> 230

And I want to calculate the sum by iphone/ipad/mac, and output it like this :

A245 B300 C230

A stands for iphone, B for ipad, C for mac.
How should I do this using Shell script? Thanks.

Source: shell

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.