?

Log in

No account? Create an account

Previous Entry | Next Entry

Adding Salary: AWK

Useful, simple though!

$ cat sal.out
A Mon clerk 12
B Tue sales 13
A Wed clerk 13
C Thu sales 34
B Mon sales 13

$ awk '{arr[$1]+=$4} END {for (i in arr) {print i,arr[i]}}' sal.out
A 25
B 26
C 34 

 

Profile

jaduks
Jadu Kumar Saikia

Latest Month

January 2008
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  
Powered by LiveJournal.com
Designed by chasethestars