![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Monkcast #12: IBM HW group OEMs Solaris to chagrin of SW group & a ... - ZDNet.com bl | iBot | UNIX and Linux RSS News | 0 | 08-17-2007 05:30 PM |
| Count No of Records in File without counting Header and Trailer Records | guiguy | Shell Programming and Scripting | 2 | 06-07-2007 01:15 PM |
| find and group records in a file | thumsup9 | UNIX for Advanced & Expert Users | 20 | 04-19-2007 06:04 PM |
| Select records based on search criteria on first column | shashi_kiran_v | UNIX for Dummies Questions & Answers | 2 | 12-02-2005 01:49 PM |
| entry in /etc/group too long - problem using sudo with %group | poli | SUN Solaris | 4 | 12-21-2004 09:50 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi Guys,
Once again I have a query regarding grouping the columns, below is my requirement: Input File: COL1; COL2; AMT1;AMT2 PORT1;CURR1;100;50 PORT1;CURR1;200;100 PORT2;CURR2;300;150 PORT3;CURR3;400;200 PORT3;CURR3;500;250 Expected Output: COL1; COL2; AMT1;AMT2 PORT1;CURR1;300;150 PORT2;CURR2;300;150 PORT3;CURR3;900;450 How can I pass to values in below command: /usr/bin/nawk 'BEGIN{FS=OFS=";"}NR==1{print;next}{a[$1";"$2]+=$3}END{for(i in a)print i, a[i]}' <INPUT FILE> Please suggest so that I can get both AMT1 and AMT2 gouped by COL1 and COL2. Thanks in advance. Regards, Sandeep |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|