![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding the values of two file | Shell_Learner | Shell Programming and Scripting | 3 | 04-06-2009 05:59 AM |
| adding values with a loop | hcclnoodles | Shell Programming and Scripting | 1 | 05-27-2008 07:42 AM |
| Adding SPF records......please help | thehaapyappy | UNIX for Dummies Questions & Answers | 11 | 05-14-2008 06:20 AM |
| Generating key values for leader records | ajfaq | UNIX for Dummies Questions & Answers | 1 | 09-20-2007 09:21 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
verifying column2 for same kind of records and adding corresponding values in column3
Hi
am having a file which looks like this Quote:
i.e the output has to be like Quote:
07-Jun-2009 919449829088 52 lessrv1 07-Jun-2009 919449829088 48 lessrv6 leads to 07-Jun-2009 919449829088 100 thanks in advance |
|
||||
|
awk '{arr[$1 " " $2] += $3} END {for ( i in arr ) {print i " " arr[i]}' logfile
|
| Bits Awarded / Charged to baruchgu for this Post | |||
| Date | User | Comment | Amount |
| 06-09-2009 | aemunathan | great | 50,000 |
|
||||
|
Hi Got the answer....its nice. am getting more eagerness to master this art of shell scripting...it does everything u want in a single line itself. by the way can u explain what the line does... Code:
awk '{arr[$1 " " $2] += $3} END
its better to get it clarified ..i may misunderstood With lot of thanks Aemu |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|