gowthamvels has asked for the wisdom of the Perl Monks concerning the following question:
I need to write a PERL script to group and sort the CSV file with below sample data
The sample data from a input file looks like below.
SAMPLE INPUT INPUTFILE.csv 3211111,100,3.2 3211112,101,3.2 3211111,100,1.2 3211112,100,2.2 3211113,100,5.2 3211112,100,0.3
I need to group first two columns and sum up the third column to obtain below output file -
outputfile.csv 3211111,100,4.4 3211112,100,2.5 3211112,101,3.2 3211113,100,5.2
Please help me out.
2017-07-27 Athanasius added code tags
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: perl group by and sort from a csv input file
by Corion (Patriarch) on Jul 27, 2017 at 07:34 UTC | |
Re: perl group by and sort from a csv input file -- oneliner and lazy learning
by Discipulus (Canon) on Jul 27, 2017 at 11:05 UTC | |
Re: perl group by and sort from a csv input file
by tybalt89 (Monsignor) on Jul 27, 2017 at 10:54 UTC | |
Re: perl group by and sort from a csv input file
by Laurent_R (Canon) on Jul 27, 2017 at 08:28 UTC | |
by gowthamvels (Novice) on Aug 01, 2017 at 06:59 UTC | |
Re: perl group by and sort from a csv input file
by Tux (Canon) on Jul 27, 2017 at 10:09 UTC | |
Re: perl group by and sort from a csv input file
by Tux (Canon) on Jul 27, 2017 at 07:43 UTC | |
Re: perl group by and sort from a csv input file
by Your Mother (Archbishop) on Jul 28, 2017 at 17:10 UTC | |
by Tux (Canon) on Jul 28, 2017 at 20:15 UTC | |
by Your Mother (Archbishop) on Jul 28, 2017 at 20:43 UTC | |
by erix (Prior) on Jul 28, 2017 at 20:40 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. | |
A reply falls below the community's threshold of quality. You may see it by logging in. |
Back to
Seekers of Perl Wisdom