Converting Column to Rows in a Flat file

Hi,
Request To guide me in writing a shell program for the following requirement:
Example:if the Input File contains the follwing data

Input File Data:

80723240029,12,323,443,88,98,7,98,67,87
80723240030,12,56,6,,,3,12,56,6,7,2,3,12,56,6,7,2,3,88,98,7,98,67,87
80723240031,56,57,d,88,98,7,98,67,87,88,98,7,98,67,87
80723250032,45,hg,3

Background:After First column every 6 columns are identified as one setand first column is the key to identify the records.

I have to convert the data as follows:
Output File Data:

80723240029,12,323,443,88,98,7
80723240029,98,67,87
80723240030,12,56,6,,,3
80723240030,12,56,6,7,2,3
80723240030,12,56,6,7,2,3
80723240030,88,98,7,98,67,87
80723240031,56,57,d,88,98,7
80723240031,98,67,87,88,98,7
80723240031,98,67,87
80723250032,45,hg,3

Thanks in Advance,
srinivas

Anything you tried yet yourself and what about looking here again on your own instead of waiting for a mail when the "job" is finished?! :mad: Sorry staff, but that sounds rude to me.

Hi Zaxxon,
The data format which i gave is the final stage wherein iam actually struck,prior to bring it to this page other things to split actual file into two file and identifying the first column.

i posted the question wherein iam unable to proceed further..

I didn't understand where it was rude pls explain..

Simply posting your email address and asking to be informed when we did your work.
People here are helping out of fun/compassion/a mood/boredom, whatever. No one gets paid for it so the way you wrote was somewhat demanding an inappropriate.

I actually didn't mean it ...

As I understand your problem, using Perl (and your sample data) I believe this will give you what you want.

#!/usr/bin/perl
my @fields;
my @hold;
my $key1;
my $x;
my $i;
open INPUT, "<file6";
open OUTPUT, ">outfile";
while(<INPUT>)
{
chomp;
@fields = split /,/, $_;
$key1 = $fields[0];
shift @fields;
while ( defined($fields[0]) )
{
for ($i = 1; $i < 7; $i++)
{
if ( defined($fields[0]) )
{
$hold[$i] = $fields[0];
shift @fields;
}
else
{
last;
}
}
$x = join ",", @hold;
$array1{$key1} = $x;
print OUTPUT "$key1$array1{$key1}\n";
@hold = ( );
}
}
close INPUT;
close OUTPUT;