how to differentiate columns of a file in perl with no specific delimiter

Hi everybody,
This time I am having one issue in perl.
I have to create comma separated file using the following type of information. The problem is the columns do not have any specific delimiter. So while using split I am getting different value. Some where it is space(S) and some where it is tab(s). in some cases I do not have values under some specific column and these are also filled with tab(s) and /or space(s).
Revsn: Date Who SID Description of Modification
09-Jul-01 Amiya 01-04Jul01 add setdescriptor shortcuts
02-Aug-99 RathA chk include 1st line
remove per VandJ
06-Jan-98 DasP data obsolete...
02-Jul-97 Gupts add DDMM for completeness

I want my output as
09-Jul-01, Amiya,01-04Jul01, add setdescriptor shortcuts
02-Aug-99,RathA,----, chk include 1st line remove VandJ (If line has only description, add to prev line)
06-Jan-98, DasP,----,data obsolete...
02-Jul-97, Gupts,----, add DDMM for completeness
Thanks in advance....

Try this:

awk '
NR>1 && /^[0-9/{printf("\n%s",$0);next}
{printf(" %s",$0)}
END{print ""}
' file

Regards

I am getting syntax erro while executing this command as below
awk: newline in character class near line 1
awk: syntax error near line 2
awk: bailing out near line 2

Use nawk, gawk or /usr/xpg4/bin/awk on Solaris.

Regards

Try this:

perl -ne '
	if (/^[0-9]{2}-[[:alpha:]]{3}-[0-9]{2}/) {
		if (defined($prev)) { printf($prev . "\n"); }
		($f1, $f2, $f3, undef, $f5) = m/([0-9]{2}-[[:alpha:]]{3}-[0-9]{2})[[:blank:]]+([[:alnum:]]+)[[:blank:]]+(([0-9]{2}-)?[0-9]{2}-?[[:alpha:]]{3}-?[0-9]{2}[[:blank:]])?(.*)/;
		if ($f3 == "") { $f3="----" }
		$prev = join(",",$f1,$f2,$f3,$f5);
	} else {
		$prev .= " " . chomp($_);
	}
	END { printf($prev . "\n"); }
' inputfile > outputfile

in order to help with a reliable solution, you need to define what this field can contain:

01-04Jul01

is it always that same format or can it be different besides just not existing? Does it always correspond with the date at the beginning of the line?

awk '{p=c; c=$0}; !/^[0-9]+/{print p,c;next}1' file

perl:

while (<>) {
    chomp; 
    $p = $c; $c = $_;
    if (!/^[0-9]+/) { print "$p $c\n" ; next ; }
    print $_ . "\n";
}

It is always starts with a date but if the description is more than one line then only the description column contains in the row all other columns are blank(filled with either tab or space) I need the description from the 2nd lne to be concat with the previous if the first three column of the 2nd line are blank.

Thanks Anni,
it is working but if the description is in the next line with all other columns are blank is not getting concatenate with the previous line. it is just print 1 in the prev line. Apart from thst if the 1st column is not started with a tab the operation is not getting printed.

Oops! Change $prev .= " " . chomp($); to chomp($prev .= " " . $);.