$ awk '{a[$1]+=$2}END{for(i in a) print i,a[i]}' file
ABC 80
XYZ 20
MNP 60
DEF 170
More Related Contents:
- In Powershell, what’s the best way to join two tables into one?
- How to delete items from a dictionary while iterating over it?
- Escaping Double Quotes in Batch Script
- Add a prefix string to beginning of each line
- Scripting Language vs Programming Language [closed]
- Using sed, Insert a line above or below the pattern? [duplicate]
- Running a CMD or BAT in silent mode
- Stopping scripters from slamming your website
- What are the best ways to automate a GDB debugging session?
- Determine if current PowerShell Process is 32-bit or 64-bit?
- How do you execute an arbitrary native command from a string?
- VBScript getting results from Shell
- How to compile a linux shell script to be a standalone executable *binary* (i.e. not just e.g. chmod 755)?
- Creating a script for a Telnet session?
- gdb scripting: execute commands at selected breakpoint
- Visual Basic scripting dynamic array
- Best tool(s) for decompiling Lua bytecode? [closed]
- Move folder from one directory to another in batch script
- How can I remove the first line of a text file using bash/sed script?
- What is the best scripting language to embed in a C# desktop application? [closed]
- Date command does not follow Linux specifications (Mac OS X Lion)
- Shell/Bash shortcut for bulk renaming of files in a folder
- How to get started with PowerShell? [closed]
- How to I launch a ruby script from the command line by just its name?
- Date arithmetic in cmd scripting
- Best way to simulate “group by” from bash?
- Determine if a function exists in bash
- Remove part of path on Unix
- Giving the script tag an ID
- Can PHP asynchronously use sockets?