while (<DATA>) { my ($onetwo,$three) = $_=~/(.*)\|(.*)/; push @{$hash{$onetwo}},$three; } for (sort keys %hash) { print $_."|",join ",",@{$hash{$_}}; print "\n"; } __DATA__ aaa|bbb|ccc ddd|eee|fff ddd|eee|xxxxx hhh|iiii|jjjjjj
--------------------------------------------------------------
"If there is such a phenomenon as absolute evil, it consists in treating another human being as a thing."
John Brunner, "The Shockwave Rider".
In reply to Re: amalgamate similar lines
by g0n
in thread amalgamate similar lines
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |