in reply to Reformat Text File
my %result; while (<>) { chomp; my ($k, $v) = split /,/; push @{$result{$k}}, $v; } for (sort keys %result) { print join(",", $_, @{$result{$_}}), "\n"; }
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reformat Text File
by tall_man (Parson) on Oct 05, 2004 at 14:45 UTC | |
by gaal (Parson) on Oct 05, 2004 at 16:37 UTC | |
by ikegami (Patriarch) on Oct 05, 2004 at 17:36 UTC | |
by tall_man (Parson) on Oct 05, 2004 at 20:17 UTC |