Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: One to Many is Too Many?

by Eimi Metamorphoumai (Deacon)
on Apr 22, 2008 at 20:53 UTC ( #682278=note: print w/replies, xml ) Need Help??

in reply to One to Many is Too Many?

Doesn't seem that hard. The code below outputs the BUG_Comments_COMBINED.csv file, though it doesn't worry at all about the order in which it outputs lines. If that matters to you, it can be adjusted.
#!/usr/bin/perl -l use strict; use warnings; my %comment; #comment for each bug id <DATA>; #skip header line while(<DATA>){ chomp; #the 4 in the split below ignores all comma in the comment text my (undef, $bugid, $date, $body) = split(/,/, $_, 4); $comment{$bugid} .= "$date $body "; } while (my ($id, $comment) = each %comment){ print "$id, $comment"; } __DATA__ CommentId, BugId, Date, CommentBody 1023,9555,03/06/2008,This is the body 1024,9555,03/07/2008,This is the body 1025,9555,03/08/2008,This is the body

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://682278]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2020-10-20 00:13 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (208 votes). Check out past polls.