[CentOS] [OT] Bash help
Robert Arkiletian
robark at gmail.comWed Oct 25 19:08:28 UTC 2017
- Previous message: [CentOS] [OT] Bash help
- Next message: [CentOS] [OT] Bash help
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Oct 25, 2017 at 9:59 AM, Robert Arkiletian <robark at gmail.com> wrote: > On Wed, Oct 25, 2017 at 9:41 AM, Mark Haney <mark.haney at neonova.net> wrote: >> On 10/25/2017 12:33 PM, Robert Arkiletian wrote: >>> >>> here is a python solution >>> #!/usr/bin/python >>> #python 2 (did not check if it works) >>> f=open('yourfilename') >>> D={} >>> for line in f: >>> email,num = line.split() >>> if email in D: > >>> D[email] = D[email] + int(num) > >>> else: > >>> D[email] = int(num) > >>> f.close() not to be outdone, python can sort them based on the totals for k in sorted(D, key=d.get, reverse=True): print k, D[k]
- Previous message: [CentOS] [OT] Bash help
- Next message: [CentOS] [OT] Bash help
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the CentOS mailing list